
Un_Trace_SegmentArrayIndex={''};
YKGcharNF='-.';
YKGcharPool='-';

MgOColumn = find(strcmp('MgO',PetrogenMajorElement_Strings_Extracted));


%%
figure(1)
close
figure(1)
hold on
set(gcf, 'Units', 'Inches', 'Position',  [3.7917 2.8333 7.4028 9.7778], 'PaperUnits', 'Inches', 'PaperSize', [8.5, 11])
FigureTitle = 'MajorElement';
set(gcf,'name',regexprep(FigureTitle,'\_*',''))

%colorsjet = colormap(jet(size(test,2)));

IndiciesFig1_X = {...
    'CaO'  'CaO'; ...
    'CaO'  'CaO'; ...
    'FeO'  'MgO'; ...
    };

IndiciesFig1_Y = {...
    'SiO2'  'MgO'; ...
    'TiO2' 'Al2O3'; ...
    'Na2O' 'K2O'; ...
    };



axesMajors = [4.5 15 45 55; 4.5 15 3 16 ;...
    4.5 15 0 4.5 ; 4.5 15 10 22.5
    4 16 0 5; 3 16 0.01 10];



IndiciesX = upper(IndiciesFig1_X);
IndiciesY = upper(IndiciesFig1_Y);

numcolumns = 2;
numrows = 3;
subfigcount =1;


for kk = 1:size(IndiciesX,1)
    for n = 1:size(IndiciesX,2)
        
        accumulatingLegend={}; 
  
        yvalue =  IndiciesY(kk,n);
        xvalue = IndiciesX(kk,n);
        
        [a,xvalue]=(ismember(xvalue, upper(PetrogenMajorElement_Strings_Extracted)));
        [a,yvalue]=(ismember(yvalue, upper(PetrogenMajorElement_Strings_Extracted)));

        subaxis(numrows,numcolumns,subfigcount,'SpacingHoriz',.005,'SpacingVert',.05,'Margin',0.00,'Padding',0.00,'PaddingLeft',0.019,'PaddingBottom',.003,...
            'MarginBottom',.05,'MarginRight',0)
        
        
        
        %axis(axesMajors(subfigcount,:))
        hold on
        axis square
        


        plot(Galeetal2013_Glasses(:,xvalue), Galeetal2013_Glasses(:,yvalue) ,'o','Color',grey8,'LineWidth',0.1,'MarkerSize',2,'MarkerFaceColor',grey8);% GALA14 517	Galapagos
      
        plot(Galeetal2013_MajorTrace(emorbs1,xvalue), Galeetal2013_MajorTrace(emorbs1,yvalue) ,'o','Color',grey5,'LineWidth',0.1,'MarkerSize',2,'MarkerFaceColor',grey5);% GALA14 517	Galapagos
        plot(Galeetal2013_Avg(:,xvalue), Galeetal2013_Avg(:,yvalue) ,'xk','Color',black,'LineWidth',3,'MarkerSize',15,'MarkerFaceColor',black);% GALA14 517	Galapagos
        
        accumulatingLegend={accumulatingLegend{:} 'all MORB' 'E-MORB' 'Average E-,N-,D- MORB'};
        

        
        for iik=1:numberModels
           
            layerplot_color_here = eval(char(layerplot_color(iik)));
            layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
            layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
            mymarkersize = layerplot_markersize(iik);
            layerplot_marker_here = char(layerplot_marker(iik));
            
            [Xtextyy,Ytextxx] = oxideLabel(xvalue,yvalue);
            

            if any((strfind(TabNames{iik},'SM')))==1
                LegendModelcounter=1; 
                numdatapts = size(eval(sprintf('%s(:,%g)', TabNames{iik}, xvalue)),1);
                layerplot_marker_here = SM_Markers;
                
                
            
                 
                for lll = whichPrimarySM2plot
                    
                    mymarkersize = SM_MarkerSize(lll) ;
                    groupedindicies=lll:11:numdatapts;
                    
                    if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                 
                    plot(eval(sprintf('%s(groupedindicies,%g)', TabNames{iik}, xvalue)),eval(sprintf('%s(groupedindicies,%g)', TabNames{iik}, yvalue)),...
                        char(layerplot_marker_here(lll)),...
                        'Color',layerplot_color_here,...
                        'MarkerFaceColor',layerplot_color_here_fill,...
                        'LineWidth',SM_LineWidth(lll),'MarkerSize',mymarkersize,'handlevisibility',LegOnOff)
                    
                    LegendModelcounter=LegendModelcounter+1;
                end  
                    accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}}; 
            else
                
               
                
                plot(eval(sprintf('%s(:,%g)', TabNames{iik}, xvalue)),eval(sprintf('%s(:,%g)', TabNames{iik}, yvalue)),...
                    layerplot_marker_here,...
                    'Color',layerplot_color_here,...
                    'MarkerFaceColor',layerplot_color_here_fill,'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize)
                
                accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}};  
                
                
            end
        end
        

        
        
        
        if isempty(NamesForFC) ==0
            for kjm = 1:size(NamesForFC,2)
                goodTabNames2=NamesForFC(kjm);
                [a2,b2]=find(ismember(TabNames,goodTabNames2));
                
                
                majorsHere = eval(sprintf('%s', TabNames{b2}));
                

                traceHere = eval(sprintf('%s_Trace', TabNames{b2}));
                traceHere(:,44)= 0.*traceHere(:,43);
                
                
                layerplot_color_here = eval(char(layerplot_color(b2)));
                layerplot_color_here_fill = eval(char(layerplot_color_fill(b2)));
                
                
                LegendModelcounter=1; 
                val = 4;
         
                    for layerplotnumXX = whichFractionatedSM2plot
                        
                        if LegendModelcounter==1
                            LegOnOff = 'on';
                        else
                            LegOnOff = 'off';
                        end
                        
                           
                        clear testfrac testYYY
                        [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHere(layerplotnumXX,:), PetrogenMajorElement_Strings_Extracted,...
                            3, traceHere(layerplotnumXX,:),Dmatrix);
                        
                        f= [testfrac(:,MgOColumn)];
                        tmp = abs(f-val);
                        [idx idy] = min(tmp); %index of closest value
                        closest = idy;
                        
                        
                        if ismember(layerplotnumXX,[1 2 3])==1
                            
                            plot(testfrac(1:closest,xvalue),...
                                testfrac(1:closest,yvalue),...
                                YKGcharNF,'Color',layerplot_color_here_fill,'LineWidth',2,'handlevisibility',LegOnOff)                            
                        else if ismember(layerplotnumXX,[10 11])==1
                                plot(testfrac(1:closest,xvalue),...
                                    testfrac(1:closest,yvalue),...
                                    YKGcharPool,'Color',layerplot_color_here_fill,'LineWidth',2,'handlevisibility',LegOnOff)
                            else

                                plot(testfrac(1:closest,xvalue),...
                                    testfrac(1:closest,yvalue),...
                                    ':','Color',layerplot_color_here_fill,'LineWidth',1,'handlevisibility',LegOnOff)

                            end
                        end
               
                         LegendModelcounter=LegendModelcounter+1;
                    end
                
                    
                    legend2add = strcat('Ex.FC-',names4legend_all_sources{kjm});
                    legend2add = regexprep(legend2add,'-IM','');
                    legend2add = regexprep(legend2add,'-PM','');
                    legend2add = regexprep(legend2add,'-SM','');
                    accumulatingLegend={accumulatingLegend{:} legend2add};
                    
                    
            end
        end
        
        if subfigcount==6
        legend(accumulatingLegend)
        end
       
        [Xtext,Ytext,FigureTitle] = oxideLabel(xvalue,yvalue);
        xlabel([Xtext,' (wt%)'])
        ylabel([Ytext,' (wt%)'])
        
        
        box on
        

        ax = gca;
        ax.XAxis.MinorTick = 'on';
        increment = findBestIncrement( ax.XLim(2)- ax.XLim(1),ax.XAxis.TickValues(2) -  ax.XAxis.TickValues(1));
        ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
        

        
        set(gca,'ticklength',3*[0.0200    0.0500])
        set(gca,'fontsize', 13,'LineWidth',0.7,'FontName','Times New Roman')
        set(gca,'XColor', 'k')
        set(gca,'YColor', 'k')
    
        if ismember(subfigcount,[6])
            set(gca,'yscale','log')
        end
        
        subfigcount=subfigcount+1;
    end
end



for n=1:numrows.*numcolumns
    subaxis(numrows,numcolumns,n)
    ax = gca;
    xlimits = xlim;
    ylimits = ylim;
    
     if strcmp(ax.YLabel.String,'SiO_2 (wt%)')==1
        ylimits(2)=55;
     end
    
    
     axis([round(xlimits, 2, 'significant') round(ylimits, 2, 'significant')]);
    
    
    
if strcmp(ax.XScale,'linear')==1
        ax.XAxis.MinorTick = 'on';
        increment = findBestIncrement( ax.XLim(2)- ax.XLim(1),ax.XAxis.TickValues(2) -  ax.XAxis.TickValues(1));
        
        numIncre = (ax.XAxis.TickValues(2) -  ax.XAxis.TickValues(1))/increment;
        ax.XAxis.MinorTickValues = ax.XAxis.TickValues(1)-numIncre.*increment:increment:ax.XAxis.TickValues(end)+numIncre.*increment;
    else
        
        set(gca, 'Xtick',unique([[0.001 0.01 .1 1 10 100]]))
        
        curtick = get(gca, 'XTick');
        set(gca, 'XTickLabel', cellstr(num2str(curtick(:))));
        
        ax.XAxis.MinorTickValues = [.001:.001:.01 .02:.01:.1 .2:.1:1 2:1:10 20:10:100];
        
        
    end
    
    if strcmp(ax.YScale,'linear')==1
        ax.YAxis.MinorTick = 'on';
        increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
        
        
        numIncre = (ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1))/increment;
        ax.YAxis.MinorTickValues = ax.YAxis.TickValues(1)-numIncre.*increment:increment:ax.YAxis.TickValues(end)+numIncre.*increment;
    else
        
        set(gca, 'Ytick',unique([[0.001 0.01 .1 1 10 100]]))
        
        curtick = get(gca, 'YTick');
        set(gca, 'YTickLabel', cellstr(num2str(curtick(:))));
        
        ax.YAxis.MinorTickValues = [.001:.001:.01 .02:.01:.1 .2:.1:1 2:1:10 20:10:100];
        
        
    end
end

%% trace element ratios

figure(20)
close
figure(20)
hold on

FigureTitle = 'TraceElementRatios';
set(gcf,'name',regexprep(FigureTitle,'\_*',''))
set(gcf,'name',FigureTitle)



masterratiosX ={'Sm/Yb' 'Lu/Hf'};
masterratiosY ={'La/Sm' 'Th/U'};

axesMinors = [.6 20 .2 10
    .05 3   .3 2 ];


Xticks = {[ .4 1 10 50];
    [0.1 1 10]};

Yticks = {[0.05 0.1 1 10 20];
    [0.5 1:.2:2 3]};


numrows=1;
numcolumns=2;

set(gcf, 'Units', 'Inches', 'Position', [7.1667 6.6528 10.9722 6.3194],  'PaperSize', [8.5, 11])

logon = 1;

for n =1:numrows.*numcolumns
    
    subaxis(numrows,numcolumns,n,'Spacing',.09,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    axis(axesMinors(n,:))
    hold on
    axis square
    
    accumulatingLegend={}; 

    Desired_X=masterratiosX{n};
    Desired_Y=masterratiosY{n};
    [a,xvalue] = ismember(Desired_X,RatioLabels);
    [b,yvalue] = ismember(Desired_Y,RatioLabels);
    
    

    test1 = xline(1,'k-');
    test2=yline(1,'k-');
    uistack(test1,'bottom')
    uistack(test2,'bottom')
    
    
    test1 = xline(DataRatios_TraceDMM(yvalue)./TraceElements4Normalization_DataRatios(yvalue),'k-');
    test2=  yline(DataRatios_TraceDMM(xvalue)./TraceElements4Normalization_DataRatios(xvalue),'k-');
    uistack(test1,'bottom')
    uistack(test2,'bottom')
    

       plot(Galeetal2013_MajorTrace_DataRatios(:,xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
           Galeetal2013_MajorTrace_DataRatios(:,yvalue)./TraceElements4Normalization_DataRatios(yvalue)...
        ,'o','Color',grey8,'LineWidth',0.1,'MarkerSize',4,'MarkerFaceColor',grey8);
    
  
        plot(Galeetal2013_MajorTrace_DataRatios(emorbs1,xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
            Galeetal2013_MajorTrace_DataRatios(emorbs1,yvalue)./TraceElements4Normalization_DataRatios(yvalue)...
        ,'o','Color',grey5,'LineWidth',0.1,'MarkerSize',4,'MarkerFaceColor',grey5);

    plot(kimberlites_DataRatios(:,xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
        kimberlites_DataRatios(:,yvalue)./TraceElements4Normalization_DataRatios(yvalue)...
        ,'o','Color','r','LineWidth',0.1,'MarkerSize',4,'MarkerFaceColor','r');
    
    accumulatingLegend={accumulatingLegend{:} 'all MORB' 'E-MORB' 'SA kimberlites'};
    
 
    Data_GALE_colors = {'grey4','grey55','black'};
    for i = 1:size(Galeetal2013_Avg,1)
        plot(Galeetal2013_Avg_DataRatios(i,xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
            Galeetal2013_Avg_DataRatios(i,yvalue)./TraceElements4Normalization_DataRatios(yvalue),...
            'xk','LineWidth',3,'MarkerSize',15, 'Color',eval(Data_GALE_colors{i}),'MarkerFaceColor',eval(Data_GALE_colors{i}));
   
        %'o-k','LineWidth',1,'MarkerSize',12, 'Color','k','MarkerFaceColor',eval(Colors_GALE{i}));
    end
    avgLabels = strcat({'Average '},Galeetal2013_Avg_Labels);
    accumulatingLegend={accumulatingLegend{:} avgLabels{:}};     
     
    
    
    for iik=1:numberModels
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
            
        
        
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xvalue)),1);
            layerplot_marker_here = SM_Markers;
            mymarkersizeSpecial = 3;
            
            
            for lll = whichPrimarySM2plot
                  if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                mymarkersize = SM_MarkerSize(lll) ;
                groupedindicies=lll:11:numdatapts;
                
                
                plot(eval(sprintf('DataRatios_%s(groupedindicies,%g)', TabNames{iik}, xvalue))./TraceElements4Normalization_DataRatios(xvalue),eval(sprintf('DataRatios_%s(groupedindicies,%g)', ...
                    TabNames{iik}, yvalue))./TraceElements4Normalization_DataRatios(yvalue),char(layerplot_marker_here(lll)),...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',SM_LineWidth(lll),...
                    'MarkerSize',mymarkersize,'HandleVisibility',LegOnOff)
            
                  LegendModelcounter=LegendModelcounter+1;
            end
            accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}}; 
        else
           
            
            plot(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xvalue))./TraceElements4Normalization_DataRatios(xvalue),eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yvalue))./TraceElements4Normalization_DataRatios(yvalue),...
                layerplot_marker_here,...
                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'MarkerEdgeColor',layerplot_color_here_edge,...
                'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize);
            
            accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}};  
          
            
        end
    end
    
    
    colorindex = 1;
    for iiill = 1
        %indexforlenged(iii) = RidgesListIndex{iii}(1);
        clear datasmoosh;
        for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
            plot(DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
                DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yvalue)./TraceElements4Normalization_DataRatios(yvalue),...
                'o', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
            % 'o', 'color',grey5, 'markerfacecolor',white,'markersize',8,'HandleVisibility','off') % GALA14 517	Galapagos
            
            %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
            %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
            colorindex = colorindex+1;
        end
    end
    
    
    
    
    
    %      val = 4; %value to find
    %     if isempty(NamesForFC) ==0
    %         for kjm = 1:size(NamesForFC,2)
    %             goodTabNames2=NamesForFC(kjm);
    %
    %             [a2,b2]=find(ismember(TabNames,goodTabNames2));
    %             majorsHere = eval(sprintf('%s', TabNames{b2}));
    %             columnsarg = [ 3 4 5 6 7 9 10 12 11 13];
    %             majorsHereRightOrder = majorsHere(:,columnsarg);
    %             majorsHereRightOrder(isnan(majorsHereRightOrder))=0;
    %             traceHere = eval(sprintf('%s_Trace', TabNames{b2}));
    %             traceHere(:,44)= 0.*traceHere(:,43);
    %             if strcmp(FC,'on') == 1
    %                 for layerplotnumXX = whichFractionatedSM2plot
    %
    %
    %                         clear testfrac testYYY
    %                         %[testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnum,:), 6, traceHere(layerplotnum,:),Dmatrix);
    %                         [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnumXX,:), 0.001, traceHere(layerplotnumXX,:),Dmatrix);
    %
    %
    %
    %                         f= [testfrac(:,MgOColumn)];
    %                         tmp = abs(f-val);
    %                         [idx idy] = min(tmp); %index of closest value
    %                         closest = idy;
    %                         %testXXX(:,44)=[];
    %                         clear DataRatios
    %                         for gg = 1:size(ElementRatios,1)
    %                             DataRatios(:,gg) = testXXX(:,ElementRatiosIndex(gg,1)) ./testXXX(:,ElementRatiosIndex(gg,2));
    %                             DataRatios(:,21) = 2.*(testXXX(:,EuCol)./0.154)./((testXXX(:,SmCol)./0.406)+(testXXX(:,GdCol)./0.544));
    %                         end
    %
    %                         plot(DataRatios(1:closest,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios(1:closest,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
    %                             '-','Color','k','LineWidth',3);
    %
    %                         clear testfrac testYYY
    %                         [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnumXX,:), 6, traceHere(layerplotnumXX,:),Dmatrix);
    %                         f= [testfrac(:,MgOColumn)];
    %                         tmp = abs(f-val);
    %                         [idx idy] = min(tmp); %index of closest value
    %                         closest = idy;
    %                         %testXXX(:,44)=[];
    %                         clear DataRatios
    %                         for gg = 1:size(ElementRatios,1)
    %                             DataRatios(:,gg) = testXXX(:,ElementRatiosIndex(gg,1)) ./testXXX(:,ElementRatiosIndex(gg,2));
    %                             DataRatios(:,21) = 2.*(testXXX(:,EuCol)./0.154)./((testXXX(:,SmCol)./0.406)+(testXXX(:,GdCol)./0.544));
    %                         end
    %
    %
    %                         % plot(DataRatios(1:closest,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios(1:closest,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
    %                         %      '.-','Color','k','LineWidth',3);
    %
    %                 end
    %             end
    %         end
    %     end
    
    
    xlabel(sprintf('%s_{%s}',RatioLabels{xvalue}, normalizationLabel));
    ylabel(sprintf('%s_{%s}',RatioLabels{yvalue}, normalizationLabel));
    
    
    box on
    axis square
    set(gca,'ticklength',2*[0.0200    0.0500])
    set(gca,'fontsize', 17,'LineWidth',0.7,'FontName','Times New Roman')
    set(gca,'XColor', 'k')
    set(gca,'YColor', 'k')
    if logon ==1
        set(gca,'yscale','log')
        set(gca,'xscale','log')
    end
    
    %set(gca, 'Xtick',1500:10:1540)
    ax = gca;
    
    set(gca, 'Ytick',unique([axesMinors(n,3:4) Yticks{n}]))
    set(gca, 'Xtick',unique([axesMinors(n,1:2) Xticks{n}]))
    
    curtick = get(gca, 'XTick');
    set(gca, 'XTickLabel', cellstr(num2str(curtick(:))));
    curtick = get(gca, 'YTick');
    set(gca, 'YTickLabel', cellstr(num2str(curtick(:))));
    
    
    %  ax.XAxis.MinorTick = 'on';
    %     increment = findBestIncrement( ax.XLim(2)- ax.XLim(1),ax.XAxis.TickValues(2) -  ax.XAxis.TickValues(1));
    %  ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
    %set(ax,'XMinorTick','on')
    
    %set(gca, 'Ytick',[.4 .6 .8  1 1.2 1.4  1.6 1.8 2 2.2 3 ])
    
    
    if logon ==1
        set(gca,'yscale','log')
        set(gca,'xscale','log')
    end
    
    % if n == 3
    %
    %    ax.YAxis.MinorTickValues = [[axesMinors(n,1):.001:.01] [.02:.1:3] ];%[2:1:axesMinors(n,2)]
    % end
end


hleg=legend(accumulatingLegend);
set(hleg,'FontSize',9)


%%
figure(21)
close
figure(21)
hold on

FigureTitle = 'TraceElementRatios_NdHf';
set(gcf,'name',regexprep(FigureTitle,'\_*',''))
set(gcf,'name',FigureTitle)


masterratiosX ={'Sm/Yb' 'Lu/Hf'};
masterratiosY ={'La/Sm' 'Hf/Nd'};

axesMinors = [.6 20 .2 10
    .05 3   .3 2 ];


Xticks = {[ .4 1 10 50];
    [0.1 1 10]};

Yticks = {[0.05 0.1 1 10 20];
    [0.5 1:.2:2 3]};


numrows=1;
numcolumns=2;
set(gcf, 'Units', 'Inches', 'Position', [7.1667 6.6528 10.9722 6.3194],  'PaperSize', [8.5, 11])



logon = 1;

for n = 1:numrows.*numcolumns
    
    subaxis(numrows,numcolumns,n,'Spacing',.09,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    axis(axesMinors(n,:))
    hold on
    axis square
    
    accumulatingLegend={}; 

    Desired_X=masterratiosX{n};
    Desired_Y=masterratiosY{n};
    [a,xvalue] = ismember(Desired_X,RatioLabels);
    [b,yvalue] = ismember(Desired_Y,RatioLabels);
    
    
   
    test1 = xline(1,'k-');
    test2=yline(1,'k-');
    uistack(test1,'bottom')
    uistack(test2,'bottom')
    
    
    test1 = xline(DataRatios_TraceDMM(yvalue)./TraceElements4Normalization_DataRatios(yvalue),'k-');
    test2=  yline(DataRatios_TraceDMM(xvalue)./TraceElements4Normalization_DataRatios(xvalue),'k-');
    uistack(test1,'bottom')
    uistack(test2,'bottom')
    

       plot(Galeetal2013_MajorTrace_DataRatios(:,xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
           Galeetal2013_MajorTrace_DataRatios(:,yvalue)./TraceElements4Normalization_DataRatios(yvalue)...
        ,'o','Color',grey8,'LineWidth',0.1,'MarkerSize',4,'MarkerFaceColor',grey8);
    
  
        plot(Galeetal2013_MajorTrace_DataRatios(emorbs1,xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
            Galeetal2013_MajorTrace_DataRatios(emorbs1,yvalue)./TraceElements4Normalization_DataRatios(yvalue)...
        ,'o','Color',grey5,'LineWidth',0.1,'MarkerSize',4,'MarkerFaceColor',grey5);

    plot(kimberlites_DataRatios(:,xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
        kimberlites_DataRatios(:,yvalue)./TraceElements4Normalization_DataRatios(yvalue)...
        ,'o','Color','r','LineWidth',0.1,'MarkerSize',4,'MarkerFaceColor','r');
    
    accumulatingLegend={accumulatingLegend{:} 'all MORB' 'E-MORB' 'SA kimberlites'};
    
 
    Data_GALE_colors = {'grey4','grey55','black'};
    for i = 1:size(Galeetal2013_Avg_DataRatios,1)
        plot(Galeetal2013_Avg_DataRatios(i,xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
            Galeetal2013_Avg_DataRatios(i,yvalue)./TraceElements4Normalization_DataRatios(yvalue),...
            'xk','LineWidth',3,'MarkerSize',15, 'Color',eval(Data_GALE_colors{i}),'MarkerFaceColor',eval(Data_GALE_colors{i}));
  
        %'o-k','LineWidth',1,'MarkerSize',12, 'Color','k','MarkerFaceColor',eval(Colors_GALE{i}));
    end
    avgLabels = strcat({'Average '},Galeetal2013_Avg_Labels);
    accumulatingLegend={accumulatingLegend{:} avgLabels{:}};     
     
    
    
    for iik=1:numberModels
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
            
        
        
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xvalue)),1);
            layerplot_marker_here = SM_Markers;
            mymarkersizeSpecial = 3;
            
            
            for lll = whichPrimarySM2plot
                  if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                mymarkersize = SM_MarkerSize(lll) ;
                groupedindicies=lll:11:numdatapts;
                
                
                plot(eval(sprintf('DataRatios_%s(groupedindicies,%g)', TabNames{iik}, xvalue))./TraceElements4Normalization_DataRatios(xvalue),eval(sprintf('DataRatios_%s(groupedindicies,%g)', ...
                    TabNames{iik}, yvalue))./TraceElements4Normalization_DataRatios(yvalue),char(layerplot_marker_here(lll)),...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',SM_LineWidth(lll),...
                    'MarkerSize',mymarkersize,'HandleVisibility',LegOnOff)
            
                  LegendModelcounter=LegendModelcounter+1;
            end
            accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}}; 
        else
           
            
            plot(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xvalue))./TraceElements4Normalization_DataRatios(xvalue),eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yvalue))./TraceElements4Normalization_DataRatios(yvalue),...
                layerplot_marker_here,...
                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'MarkerEdgeColor',layerplot_color_here_edge,...
                'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize);
            
            accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}};  
          
            
        end
    end
    
    
    colorindex = 1;
    for iiill = 1
        %indexforlenged(iii) = RidgesListIndex{iii}(1);
        clear datasmoosh;
        for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
            plot(DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},xvalue)./TraceElements4Normalization_DataRatios(xvalue),...
                DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yvalue)./TraceElements4Normalization_DataRatios(yvalue),...
                'o', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
            % 'o', 'color',grey5, 'markerfacecolor',white,'markersize',8,'HandleVisibility','off') % GALA14 517	Galapagos
            
            %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
            %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
            colorindex = colorindex+1;
        end
    end
    
    
    
    
    
    %      val = 4; %value to find
    %     if isempty(NamesForFC) ==0
    %         for kjm = 1:size(NamesForFC,2)
    %             goodTabNames2=NamesForFC(kjm);
    %
    %             [a2,b2]=find(ismember(TabNames,goodTabNames2));
    %             majorsHere = eval(sprintf('%s', TabNames{b2}));
    %             columnsarg = [ 3 4 5 6 7 9 10 12 11 13];
    %             majorsHereRightOrder = majorsHere(:,columnsarg);
    %             majorsHereRightOrder(isnan(majorsHereRightOrder))=0;
    %             traceHere = eval(sprintf('%s_Trace', TabNames{b2}));
    %             traceHere(:,44)= 0.*traceHere(:,43);
    %             if strcmp(FC,'on') == 1
    %                 for layerplotnumXX = whichFractionatedSM2plot
    %
    %
    %                         clear testfrac testYYY
    %                         %[testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnum,:), 6, traceHere(layerplotnum,:),Dmatrix);
    %                         [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnumXX,:), 0.001, traceHere(layerplotnumXX,:),Dmatrix);
    %
    %
    %
    %                         f= [testfrac(:,MgOColumn)];
    %                         tmp = abs(f-val);
    %                         [idx idy] = min(tmp); %index of closest value
    %                         closest = idy;
    %                         %testXXX(:,44)=[];
    %                         clear DataRatios
    %                         for gg = 1:size(ElementRatios,1)
    %                             DataRatios(:,gg) = testXXX(:,ElementRatiosIndex(gg,1)) ./testXXX(:,ElementRatiosIndex(gg,2));
    %                             DataRatios(:,21) = 2.*(testXXX(:,EuCol)./0.154)./((testXXX(:,SmCol)./0.406)+(testXXX(:,GdCol)./0.544));
    %                         end
    %
    %                         plot(DataRatios(1:closest,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios(1:closest,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
    %                             '-','Color','k','LineWidth',3);
    %
    %                         clear testfrac testYYY
    %                         [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnumXX,:), 6, traceHere(layerplotnumXX,:),Dmatrix);
    %                         f= [testfrac(:,MgOColumn)];
    %                         tmp = abs(f-val);
    %                         [idx idy] = min(tmp); %index of closest value
    %                         closest = idy;
    %                         %testXXX(:,44)=[];
    %                         clear DataRatios
    %                         for gg = 1:size(ElementRatios,1)
    %                             DataRatios(:,gg) = testXXX(:,ElementRatiosIndex(gg,1)) ./testXXX(:,ElementRatiosIndex(gg,2));
    %                             DataRatios(:,21) = 2.*(testXXX(:,EuCol)./0.154)./((testXXX(:,SmCol)./0.406)+(testXXX(:,GdCol)./0.544));
    %                         end
    %
    %
    %                         % plot(DataRatios(1:closest,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios(1:closest,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
    %                         %      '.-','Color','k','LineWidth',3);
    %
    %                 end
    %             end
    %         end
    %     end
    
    
    xlabel(sprintf('%s_{%s}',RatioLabels{xvalue}, normalizationLabel));
    ylabel(sprintf('%s_{%s}',RatioLabels{yvalue}, normalizationLabel));
    
    
    box on
    axis square
    set(gca,'ticklength',2*[0.0200    0.0500])
    set(gca,'fontsize', 17,'LineWidth',0.7,'FontName','Times New Roman')
    set(gca,'XColor', 'k')
    set(gca,'YColor', 'k')
    if logon ==1
        set(gca,'yscale','log')
        set(gca,'xscale','log')
    end
    
    %set(gca, 'Xtick',1500:10:1540)
    ax = gca;
    
    set(gca, 'Ytick',unique([axesMinors(n,3:4) Yticks{n}]))
    set(gca, 'Xtick',unique([axesMinors(n,1:2) Xticks{n}]))
    
    curtick = get(gca, 'XTick');
    set(gca, 'XTickLabel', cellstr(num2str(curtick(:))));
    curtick = get(gca, 'YTick');
    set(gca, 'YTickLabel', cellstr(num2str(curtick(:))));
    
    
    %  ax.XAxis.MinorTick = 'on';
    %     increment = findBestIncrement( ax.XLim(2)- ax.XLim(1),ax.XAxis.TickValues(2) -  ax.XAxis.TickValues(1));
    %  ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
    %set(ax,'XMinorTick','on')
    
    %set(gca, 'Ytick',[.4 .6 .8  1 1.2 1.4  1.6 1.8 2 2.2 3 ])
    
    
    if logon ==1
        set(gca,'yscale','log')
        set(gca,'xscale','log')
    end
    
    % if n == 3
    %
    %    ax.YAxis.MinorTickValues = [[axesMinors(n,1):.001:.01] [.02:.1:3] ];%[2:1:axesMinors(n,2)]
    % end
end


hleg=legend(accumulatingLegend);
set(hleg,'FontSize',9)





%%
% spider diagram

figure(30)
close
figure(30)
hold on
set(gca,'FontName','Times New Roman')
FigureTitle = 'SpiderDiagram_PrimaryMelts';
set(gcf,'name',regexprep(FigureTitle,'\_*',''))
set(gcf,'name',FigureTitle)
set(gcf,'Position',[144 206 1120 499])



logon = 1;
specialMarkerColor = {'garnetRed' 'garnetRed' 'garnetRed' 'cadmiumgreen'  'cadmiumgreen'  'cadmiumgreen' 'blue'  'blue'  'blue' 'black' 'black'};
which2plot_spider = [1 3 4 6 7 9 10 11];

yyvalue = [1:43];
yytargets = {'Rb' 'Ba'	'Pb'	'Sr'	'La'	'Ce'	'Pr'	'Nd'	'Sm'	'Eu'	'Gd'	'Tb'	'Dy'	'Ho'	'Y'	'Er'	'Yb'	'Lu'	'Sc'	'Th'	'U'	'Zr'	'Hf'	'Nb'	'Ta'};
[a,yyvalue]=(ismember(yytargets, targetStrings_Trace));
numberElements = size(yyvalue,2);


for n = [1]
    hold on
    
    
    % emorb : grey2 #3
    % nmorb: grey55 #1
    % dmorb grey7 #2
    %1-nmorb 2-dmorb 30emorb
    
    % GaleOrderedjustTrace = GaleDataOrderedTrace(:,14:end);
    
    
    % Data_GALE_colors = {'grey4','grey55','black'};
    % plot([1:numberElements],...
    % bsxfun(@rdivide,GaleOrderedjustTrace(:,yyvalue),TraceElements4Normalization(yyvalue)),...
    % '-', 'color',grey8, 'markerfacecolor',grey8,'LineWidth',.5,'HandleVisibility','off') % GALA14 517	Galapagos
    % Data_GALE_here = Avg_Gale';
    % markersizegalehere = 15;
    % LineWidthgalehere = 3;
    % plot([1:numberElements],...
    % bsxfun(@rdivide,Data_GALE_here(3,yyvalue),TraceElements4Normalization(yyvalue)),...
    % 'x', 'color',eval(Data_GALE_colors{3}), 'markerfacecolor',eval(Data_GALE_colors{3}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    % plot([1:numberElements],...
    % bsxfun(@rdivide,Data_GALE_here(1,yyvalue),TraceElements4Normalization(yyvalue)),...
    % 'x', 'color',eval(Data_GALE_colors{1}), 'markerfacecolor',eval(Data_GALE_colors{1}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    % plot([1:numberElements],...
    % bsxfun(@rdivide,Data_GALE_here(2,yyvalue),TraceElements4Normalization(yyvalue)),...
    % 'x', 'color',eval(Data_GALE_colors{2}), 'markerfacecolor',eval(Data_GALE_colors{2}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    % % plot([1:numberElements],...
    % % bsxfun(@rdivide,kimberlites_Trace(1,yyvalue),TraceElements4Normalization(yyvalue)),...
    % % 'o-', 'color','r', 'markerfacecolor','r','markersize',4); %'HandleVisibility','off') % GALA14 517	Galapagos
    % plot([1:numberElements],...
    % bsxfun(@rdivide,kimberlites_Trace(:,yyvalue),TraceElements4Normalization(yyvalue)),...
    % 'o-', 'color','r', 'markerfacecolor','r','markersize',4); %'HandleVisibility','off') % GALA14 517	Galapagos
    % legend('E-MORB','N-MORB','D-MORB','South African kimberlites','location','Best','autoupdate','off')
    % LineWidthgalehere = 4;
    % plot([1:numberElements],...
    % bsxfun(@rdivide,Data_GALE_here(3,yyvalue),TraceElements4Normalization(yyvalue)),...
    % '-', 'color',eval(Data_GALE_colors{3}), 'markerfacecolor',eval(Data_GALE_colors{3}),'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    % plot([1:numberElements],...
    % bsxfun(@rdivide,Data_GALE_here(1,yyvalue),TraceElements4Normalization(yyvalue)),...
    % '-', 'color',eval(Data_GALE_colors{1}), 'markerfacecolor',eval(Data_GALE_colors{1}),'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    % plot([1:numberElements],...
    % bsxfun(@rdivide,Data_GALE_here(2,yyvalue),TraceElements4Normalization(yyvalue)),...
    % '-', 'color',eval(Data_GALE_colors{2}), 'markerfacecolor',eval(Data_GALE_colors{2}),'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    % markersizegalehere = 15;
    % LineWidthgalehere = 3;
    % plot([1:numberElements],...
    % bsxfun(@rdivide,Data_GALE_here(3,yyvalue),TraceElements4Normalization(yyvalue)),...
    % 'x', 'color',eval(Data_GALE_colors{3}), 'markerfacecolor',eval(Data_GALE_colors{3}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    % plot([1:numberElements],...
    % bsxfun(@rdivide,Data_GALE_here(1,yyvalue),TraceElements4Normalization(yyvalue)),...
    % 'x', 'color',eval(Data_GALE_colors{1}), 'markerfacecolor',eval(Data_GALE_colors{1}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    % plot([1:numberElements],...
    % bsxfun(@rdivide,Data_GALE_here(2,yyvalue),TraceElements4Normalization(yyvalue)),...
    % 'x', 'color',eval(Data_GALE_colors{2}), 'markerfacecolor',eval(Data_GALE_colors{2}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    
    
    
    
    %(Becker and Le Roex, 2006)
    
    % plot([1:numberElements],...
    % bsxfun(@rdivide,GaleOrderedjustTrace(:,yyvalue),TraceElements4Normalization(yyvalue)),...
    % '-', 'color',grey8, 'markerfacecolor',grey8,'LineWidth',.5) % GALA14 517	Galapagos
    %
    %
    % plot([1:numberElements],...
    % bsxfun(@rdivide,kimberlites_Trace(:,yyvalue),TraceElements4Normalization(yyvalue)),...
    % 'o-', 'color','r', 'markerfacecolor','r','markersize',4); %'HandleVisibility','off') % GALA14 517	Galapagos
    
    
    accumulatingLegend={}; 
    
    for iik=whichmodel
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
           
 
        
        if any((strfind(TabNames{iik},'SM')))==1
    
            numdatapts = size(eval(sprintf('%s_Trace(:,yyvalue)', TabNames{iik})),1);
            layerplot_marker_here = SM_Markers;
            mymarkersizeSpecial = 3;
            
            for lll = 1:numdatapts
                if ismember(lll,which2plot_spider)
                    
                    
                    layerplot_color_here = eval(char(specialMarkerColor(lll)));
                    mymarkersize = SM_MarkerSize(lll) ;
                    linewidthhere = SM_LineWidth(lll);
                    layerplot_marker_here_here=char(layerplot_marker_here(lll));
                    
                    layerplot_marker_here_here=strcat('-',layerplot_marker_here_here);
                    
                    plot([1:numberElements], (eval(sprintf('%s_Trace(lll,yyvalue)',TabNames{iik}))./TraceElements4Normalization(yyvalue)),...
                        '-','Color',layerplot_color_here,'LineWidth',3,'handlevisibility','off')
                   
                    
                    plot([1:numberElements], (eval(sprintf('%s_Trace(lll,yyvalue)',TabNames{iik}))./TraceElements4Normalization(yyvalue)),...
                        layerplot_marker_here_here,...
                        'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here,'LineWidth',linewidthhere,'MarkerSize',...
                        mymarkersize,'MarkerEdgeColor',layerplot_color_here_edge);

                end 
            end
            
            accumulatingLegend={accumulatingLegend{:} SMlabels{which2plot_spider}};
            
        else
            
            
            %uncomment plotting all near-fractional melts...
            if any((strfind(TabNames{iik},'IM')))==1
                layerplot_marker_here='-';
            end
            
       
                plot([1:numberElements],bsxfun(@rdivide,eval(sprintf('%s_Trace(1,yyvalue)', TabNames{iik})),TraceElements4Normalization(yyvalue)),...
                layerplot_marker_here,...
                'Color',layerplot_color_here_fill,'MarkerFaceColor',layerplot_color_here_fill,'MarkerEdgeColor',layerplot_color_here_edge,...
                'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize ,'handlevisibility','on')
            
            
            plot([1:numberElements],bsxfun(@rdivide,eval(sprintf('%s_Trace(:,yyvalue)', TabNames{iik})),TraceElements4Normalization(yyvalue)),...
                layerplot_marker_here,...
                'Color',layerplot_color_here_fill,'MarkerFaceColor',layerplot_color_here_fill,'MarkerEdgeColor',layerplot_color_here_edge,...
                'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize ,'handlevisibility','off')
            
            
            accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}};
            
        end
    end
    
    
    
    
    GaleOrderedjustTrace = Galeetal2013_MajorTrace_Trace(:,14:end);
    colorindex = 1;
    for iiill = 1% suball
        %indexforlenged(iii) = RidgesListIndex{iii}(1);
        clear datasmoosh;
        for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
            
            xdata =  GaleOrderedjustTrace(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yyvalue);
            xdata = xdata(subset,:);
            
            plot([1:numberElements],...
                bsxfun(@rdivide,xdata,TraceElements4Normalization(yyvalue)),...
                '-', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',8,'linewidth',5) % GALA14 517	Galapagos
            
            plot([1:numberElements],...
                bsxfun(@rdivide,xdata,TraceElements4Normalization(yyvalue)),...
                'd', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',6) % GALA14 517	Galapagos
            
            
            % 'o', 'color',colorsjetTrace(colorindex,:), 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
            %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
            %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
            colorindex = colorindex+1;
        end
    end
    
             
            hleg=legend(accumulatingLegend,'Location','Best','autoupdate','off');
            set(hleg,'FontSize',12)
    
    
    
    %text(10,.5,[SourceComp regexprep(goodTabNames(whichmodel),'_','-')],'FontName','Times New Roman','FontSize',20)
    
    
    
    
    test1 = xline(1,'k-');
    test2=yline(1,'k-');
    uistack(test1,'bottom')
    uistack(test2,'bottom')
    
    
    
    box on
    %grid on
    set(gca, 'Xtick',1:1:numberElements)
    %axis([1,numberElements,10^-1,100])
    axis([1,numberElements,.1,1000])
    %axis([1,numberElements,.1,100])
    set(gca,'XTickLabel',targetStrings_Trace(yyvalue))
    set(gca,'yscale','log')
    xline(1);
    title('')
    box on
    %grid on
    ylabel('Concentration_{PUM}')
    set(gca,'YTickLabel',[0.1 1 10 100 1000])
    
end

% end
% end
%uistack(h3,'bottom')
%   uistack(h2,'bottom')
%   uistack(h1,'bottom')
%set(gcf,'Position',[114 219 973 420])
%set(gcf,'Position',[81 55 1120 793])

set(gca,'ticklength',1*[0.0200    0.0500])
%set(gca,'ticklength',2*get(gca,'ticklength'))
set(gca,'fontsize', 20,'LineWidth',1)
set(gca,'XColor', 'k')
set(gca,'YColor', 'k')
set(gcf,'Position',[276 423 1120 499])


%% Spider diagram with fractionated primary magmas
figure(31)
close
figure(31)
hold on

set(gca,'FontName','Times New Roman')
FigureTitle = 'SpiderDiagram_Fractionated';
set(gcf,'name',regexprep(FigureTitle,'\_*',''))
set(gcf,'name',FigureTitle)


set(gcf,'Position',[278 8 1120 499])


yytargets = {'Rb' 'Ba'	'Pb'	'Sr'	'La'	'Ce'	'Pr'	'Nd'	'Sm'	'Eu'	'Gd'	'Tb'	'Dy'	'Ho'	'Y'	'Er'	'Yb'	'Lu'	'Sc'	'Th'	'U'	'Zr'	'Hf'	'Nb'	'Ta'};
[a,yyvalue]=(ismember(yytargets, PetrogenTraceElement_Strings));
numberElements = size(yyvalue,2);


for n = [1]
    %subaxis(numrows,numcolumns,n,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.06,'Padding',0,'PaddingLeft',0.02)
    hold on
     accumulatingLegend={}; 
    
    % emorb : grey2 #3
    % nmorb: grey55 #1
    % dmorb grey7 #2
    %1-nmorb 2-dmorb 30emorb
    
 
    Data_GALE_colors = {'grey4','grey55','black'};
    
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_MajorTrace_Trace(1,yyvalue),TraceElements4Normalization(yyvalue)),...
        '-', 'color',grey8, 'markerfacecolor',grey8,'LineWidth',.5) % GALA14 517	Galapagos
    
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_MajorTrace_Trace(:,yyvalue),TraceElements4Normalization(yyvalue)),...
        '-', 'color',grey8, 'markerfacecolor',grey8,'LineWidth',.5,'HandleVisibility','off') % GALA14 517	Galapagos
    
    
    %Data_GALE_here = Avg_Gale_Trace;
    
    %
    %             plot([1:numberElements],...
    %             bsxfun(@rdivide,Data_GALE_here(3,yyvalue),TraceElements4Normalization(yyvalue)),...
    %             'x', 'color',eval(Data_GALE_colors{3}), 'markerfacecolor',eval(Data_GALE_colors{3}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    
    
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_Avg_Trace(1,yyvalue),TraceElements4Normalization(yyvalue)),...
        'x', 'color',eval(Data_GALE_colors{1}), 'markerfacecolor',eval(Data_GALE_colors{1}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_Avg_Trace(2,yyvalue),TraceElements4Normalization(yyvalue)),...
        'x', 'color',eval(Data_GALE_colors{2}), 'markerfacecolor',eval(Data_GALE_colors{2}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_Avg_Trace(3,yyvalue),TraceElements4Normalization(yyvalue)),...
        'x', 'color',eval(Data_GALE_colors{3}), 'markerfacecolor',eval(Data_GALE_colors{3}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere) % GALA14 517	Galapagos
    
    
    plot([1:numberElements],...
    bsxfun(@rdivide,kimberlites_Trace(1,yyvalue),TraceElements4Normalization(yyvalue)),...
    'o-', 'color','r', 'markerfacecolor','r','markersize',4); %'HandleVisibility','off') % GALA14 517	Galapagos
   
    accumulatingLegend={accumulatingLegend{:} 'All MORB' ,'E-MORB','N-MORB','D-MORB','S. African kimberlites'};
    
    
  
     plot([1:numberElements],...
        bsxfun(@rdivide,kimberlites_Trace(:,yyvalue),TraceElements4Normalization(yyvalue)),...
        'o-', 'color','r', 'markerfacecolor','r','markersize',4,'handlevisibility','off'); %'HandleVisibility','off') % GALA14 517	Galapagos
    
    
    LineWidthgalehere = 4;
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_Avg_Trace(3,yyvalue),TraceElements4Normalization(yyvalue)),...
        ':', 'color',eval(Data_GALE_colors{3}), 'markerfacecolor',eval(Data_GALE_colors{3}),'LineWidth',LineWidthgalehere ,'handlevisibility','off')
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_Avg_Trace(1,yyvalue),TraceElements4Normalization(yyvalue)),...
        ':', 'color',eval(Data_GALE_colors{1}), 'markerfacecolor',eval(Data_GALE_colors{1}),'LineWidth',LineWidthgalehere ,'handlevisibility','off')
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_Avg_Trace(2,yyvalue),TraceElements4Normalization(yyvalue)),...
        ':', 'color',eval(Data_GALE_colors{2}), 'markerfacecolor',eval(Data_GALE_colors{2}),'LineWidth',LineWidthgalehere ,'handlevisibility','off')
    
    
    markersizegalehere = 15;
    LineWidthgalehere = 3;
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_Avg_Trace(3,yyvalue),TraceElements4Normalization(yyvalue)),...
        'x', 'color',eval(Data_GALE_colors{3}), 'markerfacecolor',eval(Data_GALE_colors{3}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere ,'handlevisibility','off')
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_Avg_Trace(1,yyvalue),TraceElements4Normalization(yyvalue)),...
        'x', 'color',eval(Data_GALE_colors{1}), 'markerfacecolor',eval(Data_GALE_colors{1}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere ,'handlevisibility','off')
    plot([1:numberElements],...
        bsxfun(@rdivide,Galeetal2013_Avg_Trace(2,yyvalue),TraceElements4Normalization(yyvalue)),...
        'x', 'color',eval(Data_GALE_colors{2}), 'markerfacecolor',eval(Data_GALE_colors{2}),'markersize',markersizegalehere,'LineWidth',LineWidthgalehere ,'handlevisibility','off')
    
    
    
    
    
    
    
    %(Becker and Le Roex, 2006)
    
    % plot([1:numberElements],...
    % bsxfun(@rdivide,GaleOrderedjustTrace(:,yyvalue),TraceElements4Normalization(yyvalue)),...
    % '-', 'color',grey8, 'markerfacecolor',grey8,'LineWidth',.5) % GALA14 517	Galapagos
    %
    %
    % plot([1:numberElements],...
    % bsxfun(@rdivide,kimberlites_Trace(:,yyvalue),TraceElements4Normalization(yyvalue)),...
    % 'o-', 'color','r', 'markerfacecolor','r','markersize',4); %'HandleVisibility','off') % GALA14 517	Galapagos
    
    
    % if n==1
    %         colorindex = 1;
    %     for iiill = 1% suball
    %         %indexforlenged(iii) = RidgesListIndex{iii}(1);
    %         clear datasmoosh;
    %         for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
    %          plot(DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
    %         DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
    %              'd', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',8) % GALA14 517	Galapagos
    %         % 'o', 'color',colorsjetTrace(colorindex,:), 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
    %          %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
    %          %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
    %          colorindex = colorindex+1;
    %         end
    %     end
    
    %   legendkeyhere = [test3]%, legendkey];
    
    %     for iik=1:numberModels; %1:size(TabNames2,2)
    %
    %          if ischar(layerplot_color{iik})==1
    %             layerplot_color_here = eval(char(layerplot_color(iik)));
    %         else
    %             layerplot_color_here = layerplot_color{iik};
    %          end
    %
    %         if ischar(layerplot_color_fill{iik})==1
    %             layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
    %         else
    %             layerplot_color_here_fill = layerplot_color_fill{iik};
    %         end
    %         mymarkersize = layerplot_markersize(iik);
    %
    %                 whichPrimarySM2plot = 10;
    %     if any((strfind(TabNames{iik},'SM')))==1
    %              numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
    %              layerplot_marker_here = SM_Markers;
    %             %layerplot_marker_here = layerplot_marker;
    %             mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
    %                 for lll = 1:numdatapts
    %                               if ismember(lll,whichPrimarySM2plot)
    %                                   %plot(eval(sprintf('%s(lll,%g)', TabNames{i}, xvalue)),eval(sprintf('%s(lll,%g)', TabNames{i}, yvalue)),char(layerplot_marker_here(lll)),'Color','k','MarkerFaceColor',layerplot_color_here_fill,'LineWidth',1,'MarkerSize',mymarkersize)
    %                             plot(eval(sprintf('DataRatios_%s(lll,%g)', TabNames{iik}, xxvalue))./TraceElements4Normalization_DataRatios(xxvalue),eval(sprintf('DataRatios_%s(lll,%g)', ...
    %                                 TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),char(layerplot_marker_here(lll)),...
    %                                 'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',linewidth,'MarkerSize',mymarkersize)
    %                             end
    %                 end
    %         else
    %        
    %         plot(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xxvalue))./TraceElements4Normalization_DataRatios(xxvalue),eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
    %             layerplot_marker_here,'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',linewidth,'MarkerSize',mymarkersize)
    %     end
    %     end
    
    
    %   lgd = legend(legendkeyhere,'Location','SouthWest')  ;
    %       lgd.FontSize = 10;
    %       set(lgd,'Position',    [0.2395 0.5852 0.2439 0.1683])
    %
    %
    %       %set(lgd,'Position',[0.3288 0.0730 0.1804 0.1868])
    %       %set(lgd,'Position', [0.5873 0.7684 0.1804 0.2223])
    %
    %
    % end
    
    
    
    val = 8; %MgO value to find
    if isempty(NamesForFC) ==0
        for kjm = 1:size(NamesForFC,2)
            goodTabNames2=NamesForFC(kjm);
            
            [a2,b2]=find(ismember(TabNames,goodTabNames2));
            majorsHere = eval(sprintf('%s', TabNames{b2}));
            

            traceHere = eval(sprintf('%s_Trace', TabNames{b2}));
            traceHere(:,44)= 0.*traceHere(:,43);
            
            
            plot(0,0,'color','none')
             accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{b2}};  
                for layerplotnumXX = whichFractionatedSM2plot
                    
                    clear testfrac testYYY
                    [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHere(layerplotnumXX,:), PetrogenMajorElement_Strings_Extracted,...
                        0.001, traceHere(layerplotnumXX,:),Dmatrix);
                    f= [testfrac(:,MgOColumn)];
                    
                    tmp = abs(f-val);
                    [idx idy] = min(tmp); %index of closest value
                    closest = idy;
                    
                    lll = layerplotnumXX;
                    
                    layerplot_color_here = eval(char(specialMarkerColor(lll)));
                    layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
                    
                    
                    mymarkersize = SM_MarkerSize(lll) ;
                    linewidthhere = SM_LineWidth(lll);
                    

                    layerplot_marker_here_here=char(SM_Markers(lll));
                    layerplot_marker_here_here=strcat('-',layerplot_marker_here_here);
                    
                    
                    
                    plot([1:numberElements],...
                        bsxfun(@rdivide,testXXX(closest,yyvalue),TraceElements4Normalization(yyvalue)),...
                        '-','Color',layerplot_color_here,'LineWidth',3 ,'handlevisibility','off');
                    
                    
                    plot([1:numberElements],...
                        bsxfun(@rdivide,testXXX(closest,yyvalue),TraceElements4Normalization(yyvalue)),...
                        layerplot_marker_here_here,...
                        'Color',layerplot_color_here,'LineWidth',linewidthhere,...
                        'MarkerFaceColor',layerplot_color_here, ...
                        'MarkerSize',mymarkersize,'MarkerEdgeColor',layerplot_color_here_edge,'handlevisibility','on');
       
                end
                
                leghere2addd = SMlabels(whichFractionatedSM2plot);
                leghere2addd=strcat('FC-',leghere2addd);
                accumulatingLegend={accumulatingLegend{:} leghere2addd{:}};
        end
    end
    
    
     hleg=legend(accumulatingLegend,'Location','Best','autoupdate','off');
            set(hleg,'FontSize',9)
    
    
    test1 = xline(1,'k-');
    test2=yline(1,'k-');
    uistack(test1,'bottom')
    uistack(test2,'bottom')
    
    %    text(10,.5,[SourceComp NamesForFC sprintf('Fractionated to %d wt%% MgO',val)],'FontName','Times New Roman','FontSize',20,'Interpreter','None')
    
    box on
    %grid on
    set(gca, 'Xtick',1:1:numberElements)
    %axis([1,numberElements,10^-1,100])
    axis([1,numberElements,.1,1000])
    %axis([1,numberElements,.1,100])
    set(gca,'XTickLabel',targetStrings_Trace(yyvalue))
    set(gca,'yscale','log')
    xline(1);
    title('')
    box on
    %grid on
    ylabel('Concentration_{PUM}')
    set(gca,'YTickLabel',[0.1 1 10 100 1000])
    
end

% end
% end
%uistack(h3,'bottom')
%   uistack(h2,'bottom')
%   uistack(h1,'bottom')
%set(gcf,'Position',[114 219 973 420])
%set(gcf,'Position',[81 55 1120 793])

set(gca,'ticklength',1*[0.0200    0.0500])
%set(gca,'ticklength',2*get(gca,'ticklength'))
set(gca,'fontsize', 20,'LineWidth',1)
set(gca,'XColor', 'k')
set(gca,'YColor', 'k')
set(gcf,'Position',[278 8 1120 499])

%% Alleged garnet sigs, zeta, and F, and U
masterratios={'Th/U' 'Sm/Yb'};

figure(50)
close
figure(50)
FigureTitle = 'Zeta_F_TraceIso';
set(gcf,'name',regexprep(FigureTitle,'\_*',''))
set(gcf,'name',FigureTitle)
hold on
set(gcf, 'Units', 'Inches', 'Position', [5.5417 0.4583 8.4444 12.7917], 'PaperUnits', 'Inches', 'PaperSize', [8.5, 11])


numrows=3;
numcolumns=2;


for n = 1:2
    subaxis(numrows,numcolumns,n,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    %axis(axesMinors(n,:))
    hold on
    axis square
    
    
    Desired_Y=masterratios{n};
    [b,yyvalue] = ismember(Desired_Y,RatioLabels);
 
    
    xlabel('\zeta (%)')
    ylabel(sprintf('%s normalized to %s',Desired_Y, normalizationLabel));
    
    accumulatingLegend={}; 
    
    for iik=1:numberModels
        
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
        
        
        
        
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
            layerplot_marker_here = SM_Markers;
            %layerplot_ marker_here = layerplot_marker;
            mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
            for lll = whichPrimarySM2plot
                   if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                mymarkersize = SM_MarkerSize(lll) ;
                groupedindicies=lll:11:numdatapts;
                
                %plot(eval(sprintf('%s(lll,%g)', TabNames{i}, xvalue)),eval(sprintf('%s(lll,%g)', TabNames{i}, yvalue)),char(layerplot_marker_here(lll)),'Color','k','MarkerFaceColor',layerplot_color_here_fill,'LineWidth',1,'MarkerSize',mymarkersize)
                plot(eval(sprintf('%s_WGP(groupedindicies)', TabNames{iik})),...
                    eval(sprintf('DataRatios_%s(groupedindicies,%g)', TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                    char(layerplot_marker_here(lll)),...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth', SM_LineWidth(lll),'MarkerSize',mymarkersize ,'handlevisibility',LegOnOff)
                
                LegendModelcounter=LegendModelcounter+1;
            end
              accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}}; 
         
        else
           
            
            
            plot(eval(sprintf('%s_WGP', TabNames{iik})),eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                layerplot_marker_here,...
                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                'MarkerEdgeColor',layerplot_color_here_edge,...
                'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize)
            
            accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}};  
          

        end
    end
    
    
    if n==1
        hleg=legend(accumulatingLegend,'autoupdate','off','location','best');
        set(hleg,'FontSize',9) 
    end
    
    if logon ==1
        set(gca,'yscale','log')
    end
    
end






[a,xxxvalue]=ismember('Lnexp_cumulative',ConstraintOptions);
[a,SMvalue]=ismember('FN or FP',ConstraintOptions);



for n = 1:2
    subaxis(numrows,numcolumns,n+2,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    %axis(axesMinors(n,:))
    hold on
    axis square
    box on
    
    
    Desired_Y=masterratios{n};
    [b,yyvalue] = ismember(Desired_Y,RatioLabels);
    
    
    
    for iik=1:numberModels
        
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
        
        
        
        
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
            layerplot_marker_here = SM_Markers;
            mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
            
            for lll = whichPrimarySM2plot
                  if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                mymarkersize = SM_MarkerSize(lll) ;
                groupedindicies=lll:11:numdatapts;
                
                plot(100.*eval(sprintf('%s_InfoALL(groupedindicies,%d)', TabNames{iik},SMvalue)),...
                    eval(sprintf('DataRatios_%s(groupedindicies,%g)',TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                    char(layerplot_marker_here(lll)),...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth',SM_LineWidth(lll),'MarkerSize',mymarkersize)
                
                
                
                
            end
        else
           
            
            
            plot(100.*eval(sprintf('%s_InfoALL(:,%d)', TabNames{iik},xxxvalue)),eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                layerplot_marker_here,...
                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                'MarkerEdgeColor',layerplot_color_here_edge,...
                'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize)
        end
    end
    
    xlabel(sprintf('F (%%)'));
    ylabel(sprintf('%s_{%s}',Desired_Y, normalizationLabel));
    if n ==1
        ylabel(sprintf('%s_{%s}',Desired_Y, normalizationLabel));
        
    end
    %
    % xline(DataRatios_GALE(yyvalue,1)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'k-','NMORB')
    % xline(DataRatios_GALE(yyvalue,2)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'k-','DMORB')
    % xline(DataRatios_GALE(yyvalue,3)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'k-','EMORB')
    
    
    %     for i = 1:size(Avg_Gale,1)
    %     plot(DataRatios_GALE(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_GALE(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),...
    %             'o-k','LineWidth',.5,'MarkerSize',7, 'Color','k','MarkerFaceColor',grey8);
    %                     %'o-k','LineWidth',1,'MarkerSize',12, 'Color','k','MarkerFaceColor',eval(Colors_GALE{i}));
    %     end
    
    ax = gca;
    ax.XAxis.MinorTick = 'on';
    increment = .01;
    ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
    ax.YAxis.MinorTick = 'on';
    increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
    
    ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
    
    
    
    if logon ==1
        set(gca,'yscale','log')
        %set(gca,'xscale','log')
    end
    
    
end






for n = 1:2
    subaxis(numrows,numcolumns,n+4,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    %axis(axesMinors(n,:))
    hold on
    axis square
    box on
    
    
%     Desired_Y=masterratios{n};
%     [b,yyvalue] = ismember(Desired_Y,RatioLabels);
    
    
    xlabel(sprintf('F (%%)'));
    ylabel('(^{230}Th/^{238}U)');
    
    
    plot(1,1,'o','color','none')
    
    
    for iik=1:numberModels
        
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
        
        
        
        
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
            layerplot_marker_here = SM_Markers;
            %layerplot_ marker_here = layerplot_marker;
            mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
            for lll = whichPrimarySM2plot
                groupedindicies=lll:11:numdatapts;
                mymarkersize = SM_MarkerSize(lll) ;
                  if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                
                if n == 1
                    
                    plot(100.*eval(sprintf('%s_InfoALL(groupedindicies,%d)', TabNames{iik},SMvalue)),...
                        eval(sprintf('%s_DISEQ(groupedindicies,1)', TabNames{iik})),...
                        char(layerplot_marker_here(lll)),...
                        'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                        'MarkerEdgeColor',layerplot_color_here_edge,...
                        'LineWidth',SM_LineWidth(lll),'MarkerSize',mymarkersize, 'handlevisibility','off')
                    
                    title('Zero Ingrowth')
                    
                    
                    
                else
                    plot(100.*eval(sprintf('%s_InfoALL(groupedindicies,%d)', TabNames{iik},SMvalue)),...
                        eval(sprintf('%s_DISEQ(groupedindicies,3)', TabNames{iik})),...
                        char(layerplot_marker_here(lll)),...
                        'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                        'MarkerEdgeColor',layerplot_color_here_edge,...
                        'LineWidth',SM_LineWidth(lll),'MarkerSize',mymarkersize, 'handlevisibility','off')
                    
                    title('Complete Ingrowth','FontSize',8)
                end
                
                
                
            end
        else
           
            
            
            
            if n == 1
                plot(100.*eval(sprintf('%s_InfoALL(:,%d)', TabNames{iik},xxxvalue)),...
                    eval(sprintf('%s_DISEQ(:,1)', TabNames{iik})),...
                    layerplot_marker_here,...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize)
                title('Zero Ingrowth')
            else
                plot(100.*eval(sprintf('%s_InfoALL(:,%d)', TabNames{iik},xxxvalue)),...
                    eval(sprintf('%s_DISEQ(:,3)', TabNames{iik})),...
                    layerplot_marker_here,...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize)
                   title('Complete Ingrowth','FontSize',8)
            end
            
        end
    end
    

    
    
    
    
    set(gca, 'Xtick',[.5 1 2 3 4 6 8 10])
    
    if logon ==1
        set(gca,'yscale','log')
        %set(gca,'xscale','log')
    end
    
    
end





hold on
subaxis(3,2,1)
hold on
axis([0 100 .2 2])
ax = gca;
set(gca, 'Xtick',[0:10:100])
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.XAxis.MinorTick = 'on';
increment = 5;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
ax.YAxis.MinorTick = 'on';
increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
ylabel(sprintf('%s_{%s}',RatioLabels{1}, normalizationLabel));
yline(1.34,'k:','MORB','LabelHorizontalAlignment','right');
yline(0.904,'k:');
yline(0.775,'k:');
yline(0.724,'k:');
yline(0.256,'k:');

subaxis(3,2,2)
hold on
axis([0 100 .5 10])
set(gca, 'Xtick',[0:10:100])
set(gca,'Ytick',[.1 .5 1 10])
set(gca, 'Ytick',[.01 .1 .2 .5 1 1.3 2 3 10])
ax = gca;
ax.XAxis.MinorTick = 'on';
increment = 5;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
ax.YAxis.MinorTick = 'on';
increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
ylabel(sprintf('%s_{%s}',RatioLabels{11}, normalizationLabel));
yline(4.3,'k:','MORB','LabelHorizontalAlignment','right');
yline(1.56,'k:');
yline(1.152,'k:');
yline(1.09,'k:');
yline(0.58,'k:');


subaxis(3,2,3)
hold on
axis([0 20 .2 2])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20])
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
ylabel(sprintf('%s_{%s}',RatioLabels{1}, normalizationLabel));
yline(1.34,'k:','MORB','LabelHorizontalAlignment','right');
yline(0.904,'k:');
yline(0.775,'k:');
yline(0.724,'k:');
yline(0.256,'k:');

subaxis(3,2,4)
hold on
%axis([0 .15 1 4])
axis([0 20 .5 10])
set(gca,'Xtick',[0:2:20])
set(gca, 'Ytick',[.2 .5 1 1.3 2 3])
set(gca, 'Ytick',[.01 .1 .2 .5 1 1.3 2 3 10])
%axis([0 .25 .94 1.05])
ax = gca;
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
ax.YAxis.MinorTick = 'on';
increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
yline(4.3,'k:','MORB','LabelHorizontalAlignment','right');
yline(1.56,'k:');
yline(1.152,'k:');
yline(1.09,'k:');
yline(0.58,'k:');


subaxis(3,2,5)
hold on
axis([0 20 .2 2])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20])
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
yline(1,'k-','Secular Equil','LabelHorizontalAlignment','right');

%             yline(4.3,'k:','MORB','LabelHorizontalAlignment','right');
%             yline(1.56,'k:');
yline(1.2,'k:');
yline(1.25,'k:');
yline(1.13,'k:');


subaxis(3,2,6)
hold on
axis([0 20 .2 2])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20])
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
yline(1,'k-','Secular Equil','LabelHorizontalAlignment','right','LineWidth',2);
yline(1.2,'k:');
yline(1.25,'k:');
yline(1.13,'k:');

for kk=1:numrows.*numcolumns
    subaxis(numrows,numcolumns,kk)
    hold on
    ax=gca;
    set(gca,'ticklength',1.5*[0.0300    0.0500])
    set(gca,'fontsize', 15,'LineWidth',0.7,'FontName','Times New Roman')
    set(gca,'yscale','log')
    ax.YAxis.MinorTick = 'on';
    ax.YAxis.MinorTickValues = [0.001:0.001:.01 .02:.01:.1 .2:.1:1 2:1:10 20:10:100];
    curtick = get(gca, 'XTick');
    set(gca, 'XTickLabel', cellstr(num2str(curtick(:))));
    curtick = get(gca, 'YTick');
    set(gca, 'YTickLabel', cellstr(num2str(curtick(:))));
    set(gca,'XColor', 'k')
    set(gca,'YColor', 'k')
end



%% Alleged garnet sigs, zeta, and F, and U
masterratios={'La/Sm' 'Sm/Yb'};

figure(51)
close
figure(51)
FigureTitle = 'Zeta_F_TraceIso_diffTrace';
set(gcf,'name',regexprep(FigureTitle,'\_*',''))
set(gcf,'name',FigureTitle)
hold on
set(gcf, 'Units', 'Inches', 'Position', [5.5417 0.4583 8.4444 12.7917], 'PaperUnits', 'Inches', 'PaperSize', [8.5, 11])


numrows=3;
numcolumns=2;


[a,xxxvalue]=ismember('Lnexp_cumulative',ConstraintOptions);

for n = 1:2
    subaxis(numrows,numcolumns,n,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    %axis(axesMinors(n,:))
    hold on
    axis square
    accumulatingLegend={}; 
    
    Desired_Y=masterratios{n};
    [b,yyvalue] = ismember(Desired_Y,RatioLabels);
    
    xlabel('\zeta (%)')
    ylabel(sprintf('%s_{%s}',Desired_Y, normalizationLabel));
    
    
    
    for iik=1:numberModels
        
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
        
        
        
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
            layerplot_marker_here = SM_Markers;
            %layerplot_ marker_here = layerplot_marker;
            mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
            for lll = whichPrimarySM2plot
                  if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                mymarkersize = SM_MarkerSize(lll) ;
                groupedindicies=lll:11:numdatapts;
                
                %plot(eval(sprintf('%s(lll,%g)', TabNames{i}, xvalue)),eval(sprintf('%s(lll,%g)', TabNames{i}, yvalue)),char(layerplot_marker_here(lll)),'Color','k','MarkerFaceColor',layerplot_color_here_fill,'LineWidth',1,'MarkerSize',mymarkersize)
                plot(eval(sprintf('%s_WGP(groupedindicies)', TabNames{iik})),...
                    eval(sprintf('DataRatios_%s(groupedindicies,%g)', TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                    char(layerplot_marker_here(lll)),...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth',SM_LineWidth(lll) ,'MarkerSize',mymarkersize)
                
            end
        else
           
            
            
            plot(eval(sprintf('%s_WGP', TabNames{iik})),eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                layerplot_marker_here,...
                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                'MarkerEdgeColor',layerplot_color_here_edge,...
                'LineWidth',layerplot_linewidth(iik)  ,'MarkerSize',mymarkersize)
            
            
            
            
        end
    end
    
    
    
    if logon ==1
        set(gca,'yscale','log')
    end
    
end


[a,xxxvalue]=ismember('Lnexp_cumulative',ConstraintOptions);
[a,SMvalue]=ismember('FN or FP',ConstraintOptions);


for n = 1:2
    subaxis(numrows,numcolumns,n+2,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    %axis(axesMinors(n,:))
    hold on
    axis square
    box on
    
    
    Desired_Y=masterratios{n};
    [b,yyvalue] = ismember(Desired_Y,RatioLabels);
    
    
    
    for iik=1:numberModels
        
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
        
        
        
        
        
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
            layerplot_marker_here = SM_Markers;
            mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
            
            for lll = whichPrimarySM2plot
                  if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                mymarkersize = SM_MarkerSize(lll) ;
                groupedindicies=lll:11:numdatapts;
                
                plot(100.*eval(sprintf('%s_InfoALL(groupedindicies,%d)', TabNames{iik},SMvalue)),...
                    eval(sprintf('DataRatios_%s(groupedindicies,%g)',TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                    char(layerplot_marker_here(lll)),...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth',SM_LineWidth(lll)  ,'MarkerSize',mymarkersize)
                
            end
        else
           
            
            
            plot(100.*eval(sprintf('%s_InfoALL(:,%d)', TabNames{iik},xxxvalue)),eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                layerplot_marker_here,...
                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                'MarkerEdgeColor',layerplot_color_here_edge,...
                'LineWidth',layerplot_linewidth(iik)  ,'MarkerSize',mymarkersize)
        end
    end
    
    xlabel(sprintf('F (%%)'));
    ylabel(sprintf('%s_{%s}',RatioLabels{yyvalue}, normalizationLabel));
    
    %
    % xline(DataRatios_GALE(yyvalue,1)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'k-','NMORB')
    % xline(DataRatios_GALE(yyvalue,2)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'k-','DMORB')
    % xline(DataRatios_GALE(yyvalue,3)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'k-','EMORB')
    
    
    %     for i = 1:size(Avg_Gale,1)
    %     plot(DataRatios_GALE(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_GALE(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),...
    %             'o-k','LineWidth',.5,'MarkerSize',7, 'Color','k','MarkerFaceColor',grey8);
    %                     %'o-k','LineWidth',1,'MarkerSize',12, 'Color','k','MarkerFaceColor',eval(Colors_GALE{i}));
    %     end
    
    ax = gca;
    ax.XAxis.MinorTick = 'on';
    increment = .01;
    ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
    ax.YAxis.MinorTick = 'on';
    increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
    
    ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
    
    
    
    if logon ==1
        set(gca,'yscale','log')
        %set(gca,'xscale','log')
    end
    
    
end





for n = 1:2
    subaxis(numrows,numcolumns,n+4,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    %axis(axesMinors(n,:))
    hold on
    axis square
    box on
    
    accumulatingLegend={}; 
    

    xlabel(sprintf('F (%%)'));
    ylabel('(^{230}Th/^{238}U)');
    

    for iik=1:numberModels
        
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
        
        
        
        
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
            layerplot_marker_here = SM_Markers;

            mymarkersizeSpecial = 3;
            for lll = whichPrimarySM2plot
                groupedindicies=lll:11:numdatapts;
                mymarkersize = SM_MarkerSize(lll) ;
                  if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                
                if n == 1
                    
                    plot(100.*eval(sprintf('%s_InfoALL(groupedindicies,%d)', TabNames{iik},SMvalue)),...
                        eval(sprintf('%s_DISEQ(groupedindicies,1)', TabNames{iik})),...
                        char(layerplot_marker_here(lll)),...
                        'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                        'MarkerEdgeColor',layerplot_color_here_edge,...
                        'LineWidth',SM_LineWidth(lll),'MarkerSize',mymarkersize, 'handlevisibility',LegOnOff)
                    
                    title('Zero Ingrowth')
                    
                    
                else
                    plot(100.*eval(sprintf('%s_InfoALL(groupedindicies,%d)', TabNames{iik},SMvalue)),...
                        eval(sprintf('%s_DISEQ(groupedindicies,3)', TabNames{iik})),...
                        char(layerplot_marker_here(lll)),...
                        'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                        'MarkerEdgeColor',layerplot_color_here_edge,...
                        'LineWidth',SM_LineWidth(lll),'MarkerSize',mymarkersize, 'handlevisibility',LegOnOff)
                    
                    title('Complete Ingrowth','FontSize',8)
                end
                
                 LegendModelcounter=LegendModelcounter+1;  
            end
            accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}}; 
        else
           
            if n == 1
                plot(100.*eval(sprintf('%s_InfoALL(:,%d)', TabNames{iik},xxxvalue)),...
                    eval(sprintf('%s_DISEQ(:,1)', TabNames{iik})),...
                    layerplot_marker_here,...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth',layerplot_linewidth(iik)    ,'MarkerSize',mymarkersize)
                    title('Zero Ingrowth')
            else
                plot(100.*eval(sprintf('%s_InfoALL(:,%d)', TabNames{iik},xxxvalue)),...
                    eval(sprintf('%s_DISEQ(:,3)', TabNames{iik})),...
                    layerplot_marker_here,...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth',layerplot_linewidth(iik)    ,'MarkerSize',mymarkersize)
                  title('Complete Ingrowth','FontSize',8)
            end
             accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}};  
          
            
        end
    end
    
    
        if n==2
            hleg=legend(accumulatingLegend,'Location','Best','autoupdate','off');
            set(hleg,'FontSize',9)
        end
    
    
    
    
    
    set(gca, 'Xtick',[.5 1 2 3 4 6 8 10])
    
    if logon ==1
        set(gca,'yscale','log')
        %set(gca,'xscale','log')
    end
    
    
end



hold on
subaxis(3,2,1)
hold on
axis([0 100 .2 8])
ax = gca;
set(gca, 'Xtick',[0:10:100]);
set(gca,'Ytick',[.2 .5 1:1:8])
ax.XAxis.MinorTick = 'on';
increment = 5;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
ax.YAxis.MinorTick = 'on';
increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
ax.YAxis.MinorTickValues = [.2 1:1:10];
%ylabel(sprintf('%s_{%s}',RatioLabels{1}, normalizationLabel));
yline(1.34,'k:','MORB','LabelHorizontalAlignment','right');
yline(0.904,'k:');
yline(0.775,'k:');
yline(0.724,'k:');
yline(0.256,'k:');

subaxis(3,2,2)
hold on
axis([0 100 .5 10])
set(gca, 'Xtick',[0:10:100])
set(gca,'Ytick',[.1 .5 1 10])
set(gca, 'Ytick',[.01 .1 .2 .5 1 1.3 2 3 10])
ax = gca;
ax.XAxis.MinorTick = 'on';
increment = 5;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
ax.YAxis.MinorTick = 'on';
increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
%ylabel(sprintf('%s_{%s}',RatioLabels{11}, normalizationLabel));
yline(4.3,'k:','MORB','LabelHorizontalAlignment','right');
yline(1.56,'k:');
yline(1.152,'k:');
yline(1.09,'k:');
yline(0.58,'k:');


subaxis(3,2,3)
hold on
axis([0 20 .2 8])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1:1:8])
ax.YAxis.MinorTickValues = [.2 1:1:10];
ax = gca;
set(gca,'Xtick',[0:2:20]);
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
%ylabel(sprintf('%s_{%s}',RatioLabels{1}, normalizationLabel));
yline(1.34,'k:','MORB','LabelHorizontalAlignment','right');
yline(0.904,'k:');
yline(0.775,'k:');
yline(0.724,'k:');
yline(0.256,'k:');

subaxis(3,2,4)
hold on
%axis([0 .15 1 4])
axis([0 20 .5 10])
set(gca,'Xtick',[0:2:20])
set(gca, 'Ytick',[.2 .5 1 1.3 2 3])
set(gca, 'Ytick',[.01 .1 .2 .5 1 1.3 2 3 10])
%axis([0 .25 .94 1.05])
ax = gca;
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
ax.YAxis.MinorTick = 'on';
increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
yline(4.3,'k:','MORB','LabelHorizontalAlignment','right');
yline(1.56,'k:');
yline(1.152,'k:');
yline(1.09,'k:');
yline(0.58,'k:');


subaxis(3,2,5)
hold on
axis([0 20 .2 2])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20])
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
yline(1,'k-','Secular Equil','LabelHorizontalAlignment','right');

%             yline(4.3,'k:','MORB','LabelHorizontalAlignment','right');
%             yline(1.56,'k:');
yline(1.2,'k:');
yline(1.25,'k:');
yline(1.13,'k:');


subaxis(3,2,6)
hold on
axis([0 20 .2 2])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20]);
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
yline(1,'k-','Secular Equil','LabelHorizontalAlignment','right','LineWidth',2);
yline(1.2,'k:');
yline(1.25,'k:');
yline(1.13,'k:');


for kk=1:numrows.*numcolumns
    subaxis(numrows,numcolumns,kk)
    hold on
    ax=gca;
    set(gca,'ticklength',1.5*[0.0300    0.0500])
    set(gca,'fontsize', 15,'LineWidth',0.7,'FontName','Times New Roman')
    set(gca,'yscale','log')
    ax.YAxis.MinorTick = 'on';
    ax.YAxis.MinorTickValues = [0.001:0.001:.01 .02:.01:.1 .2:.1:1 2:1:10 20:10:100];
    curtick = get(gca, 'XTick');
    set(gca, 'XTickLabel', cellstr(num2str(curtick(:))));
    curtick = get(gca, 'YTick');
    set(gca, 'YTickLabel', cellstr(num2str(curtick(:))));
    set(gca,'XColor', 'k')
    set(gca,'YColor', 'k')
end




%% Alleged garnet sigs, zeta, and F
figure(52)
close
figure(52)
hold on
FigureTitle = 'F_TraceIso';
set(gcf,'name',regexprep(FigureTitle,'\_*',''))
set(gcf,'name',FigureTitle)

masterratios = {'La/Sm' 'Eu/Eu*' 'Th/U' 'Sm/Yb'};



numrows=3;
numcolumns=2;

[a,xxxvalue]=ismember('Lnexp_cumulative',ConstraintOptions);
[a,SMvalue]=ismember('FN or FP',ConstraintOptions);


set(gcf, 'Units', 'Inches', 'Position', [5.5417 0.4583 8.4444 12.7917], 'PaperUnits', 'Inches', 'PaperSize', [8.5, 11])
hold on


for n = 1:4
    subaxis(numrows,numcolumns,n,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    %axis(axesMinors(n,:))
    hold on
    axis square
    box on
    

    Desired_Y=masterratios{n};
    [b,yyvalue] = ismember(Desired_Y,RatioLabels);
    
    
    
    for iik=1:numberModels
        
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
        

       
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
            layerplot_marker_here = SM_Markers;
            mymarkersizeSpecial = 3;
            for lll = whichPrimarySM2plot
                 
                mymarkersize = SM_MarkerSize(lll) ;
                groupedindicies=lll:11:numdatapts;
                
                
                plot(100.*eval(sprintf('%s_InfoALL(groupedindicies,%d)', TabNames{iik},SMvalue)),eval(sprintf('DataRatios_%s(groupedindicies,%g)', ...
                    TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),char(layerplot_marker_here(lll)),...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',SM_LineWidth(lll),'MarkerSize',mymarkersize)
                
            end
        else
            
        
            
            
            plot(100.*eval(sprintf('%s_InfoALL(:,%d)', TabNames{iik},xxxvalue)),...
                eval(sprintf('DataRatios_%s(:,%g)',TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                layerplot_marker_here,...
                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                'MarkerEdgeColor',layerplot_color_here_edge,...
                'LineWidth',layerplot_linewidth(iik),'MarkerSize',mymarkersize)
            
        end
    end
    
    
    
    
    xlabel(sprintf('F (%%)'));
    ylabel(sprintf('%s_{%s}',RatioLabels{yyvalue}, normalizationLabel));
    
    
    
    
    ax = gca;
    ax.XAxis.MinorTick = 'on';
    increment = 1;
    ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
    ax.YAxis.MinorTick = 'on';
    increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
    
    ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
    
    
    
    if logon ==1
        set(gca,'yscale','log')
    end
    
    
end





for n = 1:2
    subaxis(numrows,numcolumns,n+4,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.08,'Padding',0,'PaddingLeft',0.02)
    %axis(axesMinors(n,:))
    hold on
    axis square
    box on
    
 
%     Desired_Y=masterratios{n};
%     [b,yyvalue] = ismember(Desired_Y,RatioLabels);
    
    
    
    xlabel(sprintf('F (%%)'));
    ylabel('(^{230}Th/^{238}U)');
    
    
 
    accumulatingLegend={}; 
    
    for iik=1:numberModels
        
        layerplot_color_here = eval(char(layerplot_color(iik)));
        layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
        layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
        mymarkersize = layerplot_markersize(iik);
        layerplot_marker_here = char(layerplot_marker(iik));
        
        
        if any((strfind(TabNames{iik},'SM')))==1
            LegendModelcounter=1; 
            numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
            layerplot_marker_here = SM_Markers;
            
            mymarkersizeSpecial = 3;
            for lll = whichPrimarySM2plot
                  if LegendModelcounter==1
                         LegOnOff = 'on';
                    else
                        LegOnOff = 'off';
                    end
                mymarkersize = SM_MarkerSize(lll) ;
                groupedindicies=lll:11:numdatapts;
                
                if n == 1
                    
                    plot(100.*eval(sprintf('%s_InfoALL(groupedindicies,%d)', TabNames{iik},SMvalue)),...
                        eval(sprintf('%s_DISEQ(groupedindicies,1)', TabNames{iik})),...
                        char(layerplot_marker_here(lll)),...
                        'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                        'MarkerEdgeColor',layerplot_color_here_edge,...
                        'LineWidth', SM_LineWidth(lll),'MarkerSize',mymarkersize, 'handlevisibility',LegOnOff)
                    
                    title('Zero Ingrowth')
                    
                    
                    
                    
                else
                    plot(100.*eval(sprintf('%s_InfoALL(groupedindicies,%d)', TabNames{iik},SMvalue)),...
                        eval(sprintf('%s_DISEQ(groupedindicies,3)', TabNames{iik})),...
                        char(layerplot_marker_here(lll)),...
                        'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                        'MarkerEdgeColor',layerplot_color_here_edge,...
                        'LineWidth', SM_LineWidth(lll),'MarkerSize',mymarkersize, 'handlevisibility',LegOnOff)
                    
                    title('Complete Ingrowth','FontSize',8)
                end
                
                LegendModelcounter=LegendModelcounter+1;
            end
             accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}}; 
         
        else
           
            
            
            if n == 1
                plot(100.*eval(sprintf('%s_InfoALL(:,%d)', TabNames{iik},xxxvalue)),...
                    eval(sprintf('%s_DISEQ(:,1)', TabNames{iik})),...
                    layerplot_marker_here,...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth', layerplot_linewidth(iik) ,'MarkerSize',mymarkersize)
                  title('Zero Ingrowth')
                  
                
            else
                plot(100.*eval(sprintf('%s_InfoALL(:,%d)', TabNames{iik},xxxvalue)),...
                    eval(sprintf('%s_DISEQ(:,3)', TabNames{iik})),...
                    layerplot_marker_here,...
                    'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                    'MarkerEdgeColor',layerplot_color_here_edge,...
                    'LineWidth', layerplot_linewidth(iik) ,'MarkerSize',mymarkersize)
                    title('Complete Ingrowth','FontSize',8)
            end
             accumulatingLegend={accumulatingLegend{:} names4legend_all_sources{iik}};  
          
            
            
        end
    end
    
    
        if n==2
            hleg=legend(accumulatingLegend,'Location','Best','autoupdate','off');
            set(hleg,'FontSize',9)
        end
    
    set(gca, 'Xtick',[.5 1 2 3 4 6 8 10])
    
    if logon ==1
        set(gca,'yscale','log')
        %set(gca,'xscale','log')
    end
    
  
end


subaxis(3,2,1)
hold on
axis([0 20 .2 10])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20])
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);


subaxis(3,2,2)
hold on
%axis([0 20 .2 10])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
% set(gca,'Ytick',[.2 .5 1 1.3 2 3])
% ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20])
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);



subaxis(3,2,3)
hold on
axis([0 20 .2 2])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20])
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
ylabel(sprintf('%s_{%s}',RatioLabels{1}, normalizationLabel));
yline(1.34,'k:','MORB','LabelHorizontalAlignment','right');
yline(0.904,'k:');
yline(0.775,'k:');
yline(0.724,'k:');
yline(0.256,'k:');

subaxis(3,2,4)
hold on
%axis([0 .15 1 4])
axis([0 20 .5 10])
set(gca,'Xtick',[0:2:20])
set(gca, 'Ytick',[.2 .5 1 1.3 2 3])
set(gca, 'Ytick',[.01 .1 .2 .5 1 1.3 2 3 10])
%axis([0 .25 .94 1.05])
ax = gca;
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
ax.YAxis.MinorTick = 'on';
increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
ax.YAxis.MinorTickValues = ax.YLim(1):increment:ax.YLim(2);
yline(4.3,'k:','MORB','LabelHorizontalAlignment','right');
yline(1.56,'k:');
yline(1.152,'k:');
yline(1.09,'k:');
yline(0.58,'k:');



subaxis(3,2,5)
hold on
axis([0 20 .2 2])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20])
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
yline(1,'k-','Secular Equil','LabelHorizontalAlignment','right');

%             yline(4.3,'k:','MORB','LabelHorizontalAlignment','right');
%             yline(1.56,'k:');
yline(1.2,'k:');
yline(1.25,'k:');
yline(1.13,'k:');


subaxis(3,2,6)
hold on
axis([0 20 .2 2])
ax = gca;
%increment = findBestIncrement( ax.YLim(2)- ax.YLim(1),ax.YAxis.TickValues(2) -  ax.YAxis.TickValues(1));
set(gca,'Ytick',[.2 .5 1 1.3 2 3])
ax.YAxis.MinorTickValues = [.2 1 3];
ax = gca;
set(gca,'Xtick',[0:2:20])
ax.XAxis.MinorTick = 'on';
increment = 1;
ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
yline(1,'k-','Secular Equil','LabelHorizontalAlignment','right','LineWidth',2);
yline(1.2,'k:');
yline(1.25,'k:');
yline(1.13,'k:');


for kk=1:numrows.*numcolumns
    subaxis(numrows,numcolumns,kk)
    hold on
    ax=gca;
    set(gca,'ticklength',1.5*[0.0300    0.0500])
    set(gca,'fontsize', 15,'LineWidth',.7,'FontName','Times New Roman')
    set(gca,'yscale','log')
    ax.YAxis.MinorTick = 'on';
    ax.YAxis.MinorTickValues = [0.001:0.001:.01 .02:.01:.1 .2:.1:1 2:1:10 20:10:100];
    curtick = get(gca, 'XTick');
    set(gca, 'XTickLabel', cellstr(num2str(curtick(:))));
    curtick = get(gca, 'YTick');
    set(gca, 'YTickLabel', cellstr(num2str(curtick(:))));
    set(gca,'XColor', 'k')
    set(gca,'YColor', 'k')
end


return

%%

%  legend2add = strcat(names4legend_all_sources{iik},'-',SMlabels);
%                  accumulatingLegend={accumulatingLegend{:} legend2add{:}}; 

%               legend2add = strcat('FC',names4legend_all_sources{kjm},'-',SMlabels(whichFractionatedSM2plot));
%                      accumulatingLegend={accumulatingLegend{:} legend2add{:}};



%% major element trace element ratio
% Goldschmidt final figure trace element ratios
% Sept 17




figure(3)
close


% xtarget = {'MgO'};
% axesMinors = [4 14 5e-2 1e1
%         4 14 1e-1 4e0
%         4 14 4e-1 1.6e0
%     4 14  1e-1 3e0];

% xtarget = {'CaO'};
% axesMinors = [4 15 5e-2 1e1
%         4 15 1e-1 4e0
%         4 15 4e-1 1.6e0
%     4 15  1e-1 3e0];

yyvaluecombined =[6 1 3 2];

xtarget = {'K2O'};
axesMinors = [0 4 5e-2 1e1;
    0 4 1e-1 4e0;
    0 4 4e-1 1.6e0;
    0 4  1e-1 3e0];


% axesMinors = [5e-2 1e1 4e-1 1.1e1
%     1e-1 4e0 4e-1 1.1e1
%     1e-1 4e0 4e-1 1.6e0
%     1e-1 4e0  1e-1 3e0];





% xtarget = {'K2O'};
% axesMinors = [0 .8 5e-2 1e1;
%        0 .8 1e-1 4e0;
%        0 .8 4e-1 1.6e0;
%    0 .8  1e-1 3e0];

% WKR1300U05_001_1000_SM
% PUM1450U05_001_500_SM
% DMM1450U05_001_0_SM


targetStrings_Trace_all;
targetStrings_Majors = {'Temp','Pressure','SiO2','TiO2','Al2O3', 'Cr2O3','FeO','MnO','MgO','CaO','Na2O','K2O','P2O5','NiO','H2O','total','Mg#','NaK#','CaO/Al2O3wt','CaO/Al2O3moles'};
DataLabels = {'SiO2'	'TiO2'	'Al2O3'	'Cr2O3'	'FeO'	'MgO'	'CaO'	'K2O'	'Na2O'	'total'  'Mg#' 'NaK#' 'CaO/Al2O3wt'};
DataLabelsFC =  {'SiO2'	'TiO2'	'Al2O3'	'Cr2O3'	'FeO'	'MgO'	'CaO'	'K2O'	'Na2O'	'total'  'Mg#' 'Mg#' 'NaK#'};

% xtarget = {'Mg#'};
% axesMinors = [.3 .8 5e-2 1e1;
% .3 .8 1e-1 4e0;
% .3 .8 4e-1 1.6e0;
% .3 .8  1e-1 3e0];

[a,xxtargetsconvert56]=ismember(xtarget, targetStrings_Trace_all);
[a,xxtargetsconvert20]=ismember(xtarget, targetStrings_Majors);
[a,xxtargetsconvert12]=ismember(xtarget, DataLabelsFC);
[a,xxtargetsconvert13]=ismember(xtarget, DataLabels);





numrows=2;
numcolumns=2;
%Figure3FinalPaper = figure(3)
figure(3)
hold on
set(gcf,'Position',[360 1 693 704])



%[a,xxtargetsconvert]=(ismember(DataLabelsTrace(xxvalue),targetStrings_Majors));

yyvaluecombined =[6 1 3 2];


for n = 1:4
    subaxis(numrows,numcolumns,n,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.06,'Padding',0,'PaddingLeft',0.02)
    axis(axesMinors(n,:))
    hold on
    axis square
    
    
    %xxvalue = masterratios(n,1);
    yyvalue = yyvaluecombined(n);
    
   
            
            colorindex = 1;
            for iiill = 1% suball
                %indexforlenged(iii) = RidgesListIndex{iii}(1);
                clear datasmoosh;
                for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
                    plot(GaleDataOrderedTrace(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},xxtargetsconvert56),...
                        DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
                        'd', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',8) % GALA14 517	Galapagos
                    % 'o', 'color',colorsjetTrace(colorindex,:), 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
                    %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
                    %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
                    colorindex = colorindex+1;
                end
            end
            
            
            

            
            for iik=1:numberModels
                
                layerplot_color_here = eval(char(layerplot_color(iik)));
                layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
                layerplot_color_here_edge = eval(char(layerplot_color_edge(iik)));
                mymarkersize = layerplot_markersize(iik);
                layerplot_marker_here = char(layerplot_marker(iik));
                
                
                if any((strfind(TabNames{iik},'SM')))==1
                    LegendModelcounter=1; 
                    numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
                    layerplot_marker_here = SM_Markers;
                    %layerplot_marker_here = layerplot_marker;
                    mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
                    for lll = 1:numdatapts
                        mymarkersize = SM_MarkerSize(lll) ;
                        if ismember(lll,whichPrimarySM2plot)
                            %plot(eval(sprintf('%s(lll,%g)', TabNames{i}, xvalue)),eval(sprintf('%s(lll,%g)', TabNames{i}, yvalue)),char(layerplot_marker_here(lll)),'Color','k','MarkerFaceColor',layerplot_color_here_fill,'LineWidth',1,'MarkerSize',mymarkersize)
                            plot(eval(sprintf('%s(lll,%g)', TabNames{iik}, xxtargetsconvert20)),eval(sprintf('DataRatios_%s(lll,%g)', ...
                                TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),char(layerplot_marker_here(lll)),...
                                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',1,'MarkerSize',mymarkersize)
                        end
                    end
                else
                    
                   
                    
                    plot(eval(sprintf('%s(:,%g)', TabNames{iik}, xxtargetsconvert20)),eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                        layerplot_marker_here, 'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',0.5,'MarkerSize',mymarkersize)
                    
                    
                end
            end
            
            
           
            
            if isempty(NamesForFC)==0
                for kjm = 1:size(NamesForFC,2)
                    goodTabNames2=NamesForFC(kjm);
                    
                    %goodTabNames2 = goodTabNames{FCindex};
                    [a2,b2]=find(ismember(TabNames,goodTabNames2));
                    majorsHere = eval(sprintf('%s', TabNames{b2}));
                    columnsarg = [ 3 4 5 6 7 9 10 12 11 13];
                    majorsHereRightOrder = majorsHere(:,columnsarg);
                    majorsHereRightOrder(isnan(majorsHereRightOrder))=0;
                    traceHere = eval(sprintf('%s_Trace', TabNames{b2}));
                    traceHere(:,44)= 0.*traceHere(:,43);
                    %whichFractionatedSM2plot=1:34;
                    %              whichFractionatedSM2plot=[1:1:size(majorsHereRightOrder,1)];
                    %              whichFractionatedSM2plot=[10 11];
           
                        for layerplotnumXX = whichFractionatedSM2plot
                            
                            
                            
                            if any((strfind(TabNames{kjm},'gar')))==1
                                
                                clear testfrac testYYY
                                %[testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnum,:), 6, traceHere(layerplotnum,:),Dmatrix);
                                [testfrac,testXXX,testYYY] = YKG_wTRACE_gar(majorsHereRightOrder(layerplotnumXX,:), 0.001, traceHere(layerplotnumXX,:),Dmatrix);
                                f= [testfrac(:,MgOColumn)];
                                val = 4; %value to find
                                tmp = abs(f-val);
                                [idx idy] = min(tmp); %index of closest value
                                closest = idy;
                                clear DataRatios
                                for gg = 1:size(ElementRatios,1)
                                    DataRatios(:,gg) = testXXX(:,ElementRatiosIndex(gg,1)) ./testXXX(:,ElementRatiosIndex(gg,2));
                                    DataRatios(:,21) = 2.*(testXXX(:,EuCol)./0.154)./((testXXX(:,SmCol)./0.406)+(testXXX(:,GdCol)./0.544));
                                end
                                plot(testfrac(1:closest,xxtargetsconvert12),DataRatios(1:closest,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
                                    '-','Color','r','LineWidth',.5);
                                
                            else
                                clear testfrac testYYY
                                %[testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnum,:), 6, traceHere(layerplotnum,:),Dmatrix);
                                [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnumXX,:), 0.001, traceHere(layerplotnumXX,:),Dmatrix);
                                f= [testfrac(:,MgOColumn)];
                                val = 4; %value to find
                                tmp = abs(f-val);
                                [idx idy] = min(tmp); %index of closest value
                                closest = idy;
                                %                testXXX(:,44)=[];
                                clear DataRatios
                                for gg = 1:size(ElementRatios,1)
                                    DataRatios(:,gg) = testXXX(:,ElementRatiosIndex(gg,1)) ./testXXX(:,ElementRatiosIndex(gg,2));
                                    DataRatios(:,21) = 2.*(testXXX(:,EuCol)./0.154)./((testXXX(:,SmCol)./0.406)+(testXXX(:,GdCol)./0.544));
                                end
                                plot(testfrac(1:closest,xxtargetsconvert12),DataRatios(1:closest,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
                                    '-','Color','k','LineWidth',.5);
                            end
                            
                            %         clear testfrac testYYY
                            %         [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnumXX,:), 6, traceHere(layerplotnumXX,:),Dmatrix);
                            %         f= [testfrac(:,MgOColumn)];
                            %         tmp = abs(f-val);
                            %         [idx idy] = min(tmp); %index of closest value
                            %         closest = idy;
                            %                 testXXX(:,44)=[];
                            %                 clear DataRatios
                            %                 for gg = 1:size(ElementRatios,1)
                            %                 DataRatios(:,gg) = testXXX(:,ElementRatiosIndex(gg,1)) ./testXXX(:,ElementRatiosIndex(gg,2));
                            %                 end
                            %         plot(testfrac(1:closest,xxtargetsconvert),DataRatios(1:closest,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
                            %             '.-','Color','k','LineWidth',1);
                  
                    end
                end
            end
            % if n==1
            %     yline(1.5,'r-')
            % end
            %
            % if n==1
            %     xline(1.15,'r-')
            % end
            %
            % if n==2
            %     xline(1.15,'r-')
            % end
            %
            % test1 = xline(1,'k-');
            % test2=yline(1,'k-');
            % uistack(test1,'bottom')
            % uistack(test2,'bottom')
            
            
            
            h1=plot(GaleDataOrderedTrace(:,xxtargetsconvert56),DataRatios_GALEsheet(:,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue)...
                ,'o','Color',grey8,'LineWidth',0.1,'MarkerSize',1,'MarkerFaceColor',grey8);
            
            h2=plot(GaleDataOrderedTrace(emorbs1,xxtargetsconvert56),DataRatios_GALEsheet(emorbs1,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue)...
                ,'o','Color','r','LineWidth',0.1,'MarkerSize',1,'MarkerFaceColor','r');
            
            
            uistack(h2,'bottom')
            uistack(h1,'bottom')
            
            
            xlabel([xtarget{:}, ' (wt%)']);
            %xlabel(sprintf('%s normalized to %s',RatioLabels{xxtargetsconvert}, normalizationLabel));
            %ylabel(sprintf('%s normalized to %s',RatioLabels{xxtargetsconvert}, normalizationLabel));
            ylabel(sprintf('%s normalized to %s',RatioLabels{yyvalue}, normalizationLabel));
            
            box on
            %grid on
            %set(gcf,'Position',[114 219 973 420])
            % FigureTitle = sprintf('%s v. %s normalized to %s',RatioLabels{xxvalue}, RatioLabels{yyvalue}, normalizationLabel);
            % FigureTitle = regexprep(FigureTitle,'\_*','');
            % FigureTitle = regexprep(FigureTitle,'\/','-');
            
            FigureTitle = ['FinalPaper_MajorTraceElementFigure_',xtarget{:}];
            set(gcf,'name',regexprep(FigureTitle,'\_*',''))
            %title(FigureTitle)
            set(gcf,'name',FigureTitle)
            axis square
            set(gca,'ticklength',2*[0.0200    0.0500])
            %set(gca,'ticklength',2*get(gca,'ticklength'))
            set(gca,'fontsize', 13,'LineWidth',1)
            set(gca,'XColor', 'k')
            set(gca,'YColor', 'k')
            set(gca,'yscale','log')
            %set(gca,'xscale','log')

    % end
    % end
    uistack(h1,'bottom')
end


%% trace element ratio isotope
% Goldschmidt final figure trace element ratios
% Sept 17




targetStrings_Isotopes = {'87Sr/86Sr'	'143Nd/144Nd'	'206Pb/204Pb'	'207Pb/204Pb'	'208Pb/204Pb'	'176Hf/177Hf'};
targetStrings_Isotopes_HERE= {'87Sr/86Sr'	'143Nd/144Nd'	'206Pb/204Pb'	'176Hf/177Hf'};
[A,ElementIndicies4Target] = ismember(targetStrings_Isotopes_HERE, targetStrings_Isotopes);



himuMORBS = find(newlyOrderedElementsISOTOPES(:,3)>20)
ui = 1;
for uuu = 1:size( himuMORBS)
    for k = 1:numel(unique_idx_trace)
        if any(unique_idx_trace{k} == himuMORBS(uuu))==1
            HimuMORBSRidges(ui) = un_trace(k);
            HimuRidgesIndex(ui,:)=k;
            ui = ui+1;
        end
    end
end



figure(4)
close
%masterratios = [6 11; 1 11; 2 3; 1 2];
axesMinors = [5e-2 1e1 4e-1 1.1e1
    1e-1 4e0 4e-1 1.1e1
    1e-1 4e0 4e-1 1.6e0
    1e-1 4e0  1e-1 3e0];

masterratios = [6 11; 1 6; 2 3; 1 2];
axesMinors = [5e-2 1e1 .702 .706
    1e-1 4e0 .5124 .5134
    1e-1 4e0 17.5 21
    1e-1 4e0  .2827 .2835];

%UTh
stableratio = 1;
axesMinors = [.4 1.5 .702  .706
    .4 1.5 .5124 .5134
    .4 1.5 17.5 21
    .4 1.5 .2827 .2835];

%SmYb
stableratio = 11;
axesMinors = [.4 4 .702  .706
    .4 4 .5124 .5134
    .4 4 17.5 21
    .4 4 .2827 .2835];

% % %RbSr
% stableratio = 7;
% axesMinors = [0 6 .702 .706
%     0 6 .5124 .5134
%     0 6 17.5 21
%     0 6 .2827 .2835];

%UPb
% stableratio = 20;
% axesMinors = [.1 5 .702  .706
%     .1 5 .5124 .5134
%    .1 5 17.5 21
%    .1 5 .2827 .2835];

% %BaPb
% stableratio = 19;
% axesMinors = [.1 7 .702  .706
%     .1 7 .5124 .5134
%    .1 7 17.5 21
%    .1 7 .2827 .2835];


numrows=2;
numcolumns=2;
hold on

for n = 1:4
    figure(4)
    %  set(gcf,'Position',[360 1 693 704])
    set(gcf,'Position', [360 1 741 704])
    
    subaxis(numrows,numcolumns,n,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.06,'Padding',0,'PaddingLeft',0.02)
    axis(axesMinors(n,:))
    hold on
    axis square
    
    
    xxvalue = stableratio;
    yyvalue = ElementIndicies4Target(n);
    
  
            
            colorindex = 1;
            for iiill = 1% suball
                %indexforlenged(iii) = RidgesListIndex{iii}(1);
                clear datasmoosh;
                for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
                    plot(DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
                        newlyOrderedElementsISOTOPES(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yyvalue),...
                        'd', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',8) % GALA14 517	Galapagos
                    % 'o', 'color',colorsjetTrace(colorindex,:), 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
                    %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
                    %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
                    colorindex = colorindex+1;
                end
            end
            
            
            %             plot(TH(:,xvalue),TH(:,yvalue), 'vr','LineWidth',.5,'MarkerSize',3, 'Color','b','MarkerFaceColor','b');
            %             plot(HIMU(:,xvalue),HIMU(:,yvalue), 'o','LineWidth',.5,'MarkerSize',3, 'Color','r','MarkerFaceColor','r');
            %             plot(EM2(:,xvalue),EM2(:,yvalue), 'hr','LineWidth',.5,'MarkerSize',3, 'Color','c','MarkerFaceColor','c');
            %             plot(EM1(:,xvalue),EM1(:,yvalue), 'sr','LineWidth',.5,'MarkerSize',8, 'Color','m','MarkerFaceColor','m');
            %
            %
            
            plot(DataRatios_GALEsheet(emorbs1,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
                newlyOrderedElementsISOTOPES(emorbs1,yyvalue),...
                'o', 'color',grey4, 'markerfacecolor',grey4,'markersize',3)
            
            %             plot(DataRatios_GALEsheet(highSmYbMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 newlyOrderedElementsISOTOPES(highSmYbMORBS,yyvalue),...
            %                 'o', 'color','r', 'markerfacecolor','r','markersize',3)
            
            
            %                 plot(DataRatios_GALEsheet(ultraslowspreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(ultraslowspreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','m', 'markerfacecolor','m','markersize',3)
            %
            %                 plot(DataRatios_GALEsheet(slowspreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(slowspreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','r', 'markerfacecolor','r','markersize',3)
            %
            %                       plot(DataRatios_GALEsheet(intermediatespreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(intermediatespreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','b', 'markerfacecolor','b','markersize',3)
            %
            %                 plot(DataRatios_GALEsheet(fastspreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(fastspreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','c', 'markerfacecolor','c','markersize',3)
            %
            
            
            
            %     for i = 1:size(Data_SWIR,2)
            %     plot(DataRatios_SWIR(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_SWIR(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'s-r','LineWidth',2,'MarkerSize',8, 'Color','c','MarkerFaceColor',eval(Colors_SWIR{i}));
            %     end
            %
            %     for i = 1:size(Avg_Gale,1)
            %     plot(DataRatios_GALE(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_GALE(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),...
            %         'o-k','LineWidth',1,'MarkerSize',12, 'Color','k','MarkerFaceColor',eval(Colors_GALE{i}));
            %     end
            %
            %
            %       for i = 1:size(Data_McKenzie,2)
            %     plot(DataRatios_McKenzie(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_McKenzie(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'o-k','LineWidth',2,'MarkerSize',8, 'Color','k','MarkerFaceColor',eval(Colors_McKenzie{i}));
            %       end
            
            
            %      for i = 1:size(DMM_Dry,1)
            %     plot(DataRatios_DMM_Dry(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_DMM_Dry(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'p-y','LineWidth',2,'MarkerSize',8, 'Color','y','MarkerFaceColor',eval(DMM_Dry_Colors{i}));
            %      end
            
            %       for i = 1:size(Bulky1350U1,1)
            %     plot(DataRatios_Bulky1350U1(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_Bulky1350U1(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'v-y','LineWidth',2,'MarkerSize',8, 'Color',bitterLime,'MarkerFaceColor',bitterLime);
            %       end
            
            
            %doesnt work
            %plot(DataRatios_WHFC_Trace(:,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios_WHFC_Trace(:,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),'o-','Color','m','LineWidth',.1,'MarkerSize',2,'MarkerFaceColor','m');
            
            
            %         for i = 1:size(Data_McKenzie,2)
            %         plot([1:numberElements],DataRatios_McKenzie(:,i)'./DataRatios_TraceElements4Normalization(normalizationColumn,:),'o-k','LineWidth',2,'MarkerSize',10, 'Color','k','MarkerFaceColor',eval(Colors_McKenzie{i}))
            %     end
            
            
            %plot(GaleDataOrdered_Mg90(:,xindice), GaleDataOrdered_Mg90(:,i),'.', 'color','m', 'markerfacecolor','m','markersize',1) % GALA14 517	Galapagos
            
            
            %
            %                     plot(DataRatios_PUM1450U05_001_500_IA(:,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1450U05_001_500_IA(:,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     '.','LineWidth',.5,'MarkerSize',5, 'Color',airsuperiorityblue,'MarkerFaceColor',airsuperiorityblue)
            %
            %                     plot(DataRatios_PUM1300U05_001_1000_IA(:,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1300U05_001_1000_IA(:,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     '.','LineWidth',.5,'MarkerSize',5, 'Color','b','MarkerFaceColor','b')
            %
            %                     plot(DataRatios_DMM1450U05_001_0_IA_CORRECTED(:,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_DMM1450U05_001_0_IA_CORRECTED(:,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     '.','LineWidth',1,'MarkerSize',5, 'Color',olivinegreen,'MarkerFaceColor',olivinegreen)
            %
            
            %goodTabNames
            
            
            
            
            
            
            
            % for i =ihere
            %                 MarkerSizeHere = 8;
            % %                 if ismember(i,blackoutlines)==1
            % %                     colorhere = 'k';
            % %                     MarkerSizeHere = 12;
            % %                 end
            %                 plot(DataRatios_pooledGarBulks(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_pooledGarBulks(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     'p','LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','r','MarkerFaceColor','r')
            %
            %                     plot(DataRatios_pooledGarOddball(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_pooledGarOddball(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     'p','LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color',classicrose,'MarkerFaceColor',classicrose)
            % end
            
            
            
            %
            % for i =ihere
            %                 colorhere = 'r';
            %                 MarkerSizeHere = 6;
            %                 if ismember(i,blackoutlines)==1
            %                     colorhere = 'k';
            %                     MarkerSizeHere =12;
            %                 end
            %                 plot(DataRatios_PUM1300U05_001_1000_SM(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1300U05_001_1000_SM(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     char(layerplot_marker_here(i)),'LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','k','MarkerFaceColor','b')
            % end
            
            
            %
            % for i =ihere
            %                 colorhere = airsuperiorityblue;
            %                 MarkerSizeHere = 6;
            %                 if ismember(i,blackoutlines)==1
            %                     colorhere = 'k';
            %                     MarkerSizeHere = 12;
            %                 end
            %                 plot(DataRatios_PUM1450U05_001_500_SM(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1450U05_001_500_SM(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     char(layerplot_marker_here(i)),'LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','k','MarkerFaceColor',airsuperiorityblue)
            % end
            
            
            
            % for i =ihere
            %                 colorhere = 'b';
            %                 MarkerSizeHere = 6;
            %                 if ismember(i,blackoutlines)==1
            %                     colorhere = 'k';
            %                     MarkerSizeHere = 12;
            %                 end
            %                 plot(DataRatios_DMM1450U05_001_0_SM_CORRECTED(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_DMM1450U05_001_0_SM_CORRECTED(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     char(layerplot_marker_here(i)),'LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','k','MarkerFaceColor',olivinegreen)
            % end
            
            
            %        for ipp = 1:size(DMM_Dry,1)
            %       plot(DataRatios_DMM_Dry(ipp,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios_DMM_Dry(ipp,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),'o','LineWidth',1,'MarkerSize',5, 'MarkerFaceColor',eval(DMM_Dry_Colors{ipp}),'Color','none');
            %       end
            
            
            
            
            
            
            
            
            
            test2=yline(1,'k-');
            
            uistack(test2,'bottom')
            
            
            h1=plot(DataRatios_GALEsheet(:,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),newlyOrderedElementsISOTOPES(:,yyvalue)...
                ,'o','Color',grey8,'LineWidth',0.1,'MarkerSize',3,'MarkerFaceColor',grey8);
            
            
            xlabel(sprintf('%s normalized to %s',RatioLabels{xxvalue}, normalizationLabel));
            %ylabel(sprintf('%s normalized to %s',RatioLabels{yyvalue}, normalizationLabel));
            ylabel(targetStrings_Isotopes_HERE(n));
            box on
            %grid on
            %set(gcf,'Position',[114 219 973 420])
            FigureTitle = sprintf('%s v. %s normalized to %s',RatioLabels{xxvalue}, RatioLabels{yyvalue}, normalizationLabel);
            FigureTitle = regexprep(FigureTitle,'\_*','');
            FigureTitle = regexprep(FigureTitle,'\/','-');
            
            FigureTitle = 'TraceElement_Isotope_Figure';
            set(gcf,'name',regexprep(FigureTitle,'\_*',''))
            %title(FigureTitle)
            set(gcf,'name',FigureTitle)
            axis square
            set(gca,'ticklength',2*[0.0200    0.0500])
            %set(gca,'ticklength',2*get(gca,'ticklength'))
            set(gca,'fontsize', 13,'LineWidth',1)
            set(gca,'XColor', 'k')
            set(gca,'YColor', 'k')
            %  set(gca,'yscale','log')
            % set(gca,'xscale','log')
            
 
    % end
    % end
    uistack(h1,'bottom')
end




%% trace element ratio isotope
% Goldschmidt final figure trace element ratios XXXX
% Sept 17




targetStrings_Isotopes = {'87Sr/86Sr'	'143Nd/144Nd'	'206Pb/204Pb'	'207Pb/204Pb'	'208Pb/204Pb'	'176Hf/177Hf'};
targetStrings_Isotopes_HERE= {'87Sr/86Sr'	'143Nd/144Nd'	'207Pb/204Pb'	'176Hf/177Hf'};
[A,ElementIndicies4Target] = ismember(targetStrings_Isotopes_HERE, targetStrings_Isotopes);

stableratio = 1;



figure(5)
close
%masterratios = [6 11; 1 11; 2 3; 1 2];
axesMinors = [5e-2 1e1 4e-1 1.1e1
    1e-1 4e0 4e-1 1.1e1
    1e-1 4e0 4e-1 1.6e0
    1e-1 4e0  1e-1 3e0];

masterratios = [6 11; 1 6; 2 3; 1 2];
axesMinors = [5e-2 1e1 .702 .706
    1e-1 4e0 .5124 .5134
    1e-1 4e0 15.35 15.7
    1e-1 4e0  .2827 .2835];

numrows=2;
numcolumns=2;
hold on

for n = 1:4
    figure(5)
    set(gcf,'Position',[360 1 693 704])
    subaxis(numrows,numcolumns,n,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.06,'Padding',0,'PaddingLeft',0.02)
    %axis(axesMinors(n,:))
    hold on
    axis square
    
    
    xxvalue = stableratio;
    yyvalue = ElementIndicies4Target(n);
    
  
            colorindex = 1;
            for iiill = 1% suball
                %indexforlenged(iii) = RidgesListIndex{iii}(1);
                clear datasmoosh;
                for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
                    plot(GaleDataPhysicalPropertiesTrace(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},2),...
                        newlyOrderedElementsISOTOPES(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yyvalue),...
                        'd', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',8) % GALA14 517	Galapagos
                    % 'o', 'color',colorsjetTrace(colorindex,:), 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
                    %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
                    %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
                    colorindex = colorindex+1;
                end
            end
            
            
            
            
            %                 plot(DataRatios_GALEsheet(ultraslowspreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(ultraslowspreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','m', 'markerfacecolor','m','markersize',3)
            %
            %                 plot(DataRatios_GALEsheet(slowspreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(slowspreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','r', 'markerfacecolor','r','markersize',3)
            %
            %                       plot(DataRatios_GALEsheet(intermediatespreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(intermediatespreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','b', 'markerfacecolor','b','markersize',3)
            %
            %                 plot(DataRatios_GALEsheet(fastspreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(fastspreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','c', 'markerfacecolor','c','markersize',3)
            %
            
            
      
            
            %     for i = 1:size(Data_SWIR,2)
            %     plot(DataRatios_SWIR(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_SWIR(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'s-r','LineWidth',2,'MarkerSize',8, 'Color','c','MarkerFaceColor',eval(Colors_SWIR{i}));
            %     end
            %
            %     for i = 1:size(Avg_Gale,1)
            %     plot(DataRatios_GALE(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_GALE(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),...
            %         'o-k','LineWidth',1,'MarkerSize',12, 'Color','k','MarkerFaceColor',eval(Colors_GALE{i}));
            %     end
            %
            %
            %       for i = 1:size(Data_McKenzie,2)
            %     plot(DataRatios_McKenzie(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_McKenzie(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'o-k','LineWidth',2,'MarkerSize',8, 'Color','k','MarkerFaceColor',eval(Colors_McKenzie{i}));
            %       end
            
            
            %      for i = 1:size(DMM_Dry,1)
            %     plot(DataRatios_DMM_Dry(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_DMM_Dry(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'p-y','LineWidth',2,'MarkerSize',8, 'Color','y','MarkerFaceColor',eval(DMM_Dry_Colors{i}));
            %      end
            
            %       for i = 1:size(Bulky1350U1,1)
            %     plot(DataRatios_Bulky1350U1(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_Bulky1350U1(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'v-y','LineWidth',2,'MarkerSize',8, 'Color',bitterLime,'MarkerFaceColor',bitterLime);
            %       end
            
            
            %doesnt work
            %plot(DataRatios_WHFC_Trace(:,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios_WHFC_Trace(:,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),'o-','Color','m','LineWidth',.1,'MarkerSize',2,'MarkerFaceColor','m');
            
            
            %         for i = 1:size(Data_McKenzie,2)
            %         plot([1:numberElements],DataRatios_McKenzie(:,i)'./DataRatios_TraceElements4Normalization(normalizationColumn,:),'o-k','LineWidth',2,'MarkerSize',10, 'Color','k','MarkerFaceColor',eval(Colors_McKenzie{i}))
            %     end
            
            
            %plot(GaleDataOrdered_Mg90(:,xindice), GaleDataOrdered_Mg90(:,i),'.', 'color','m', 'markerfacecolor','m','markersize',1) % GALA14 517	Galapagos
            
            
            %
            %                     plot(DataRatios_PUM1450U05_001_500_IA(:,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1450U05_001_500_IA(:,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     '.','LineWidth',.5,'MarkerSize',5, 'Color',airsuperiorityblue,'MarkerFaceColor',airsuperiorityblue)
            %
            %                     plot(DataRatios_PUM1300U05_001_1000_IA(:,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1300U05_001_1000_IA(:,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     '.','LineWidth',.5,'MarkerSize',5, 'Color','b','MarkerFaceColor','b')
            %
            %                     plot(DataRatios_DMM1450U05_001_0_IA_CORRECTED(:,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_DMM1450U05_001_0_IA_CORRECTED(:,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     '.','LineWidth',1,'MarkerSize',5, 'Color',olivinegreen,'MarkerFaceColor',olivinegreen)
            %
            
            %goodTabNames
            
            
            
            
            
            
            
            % for i =ihere
            %                 MarkerSizeHere = 8;
            % %                 if ismember(i,blackoutlines)==1
            % %                     colorhere = 'k';
            % %                     MarkerSizeHere = 12;
            % %                 end
            %                 plot(DataRatios_pooledGarBulks(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_pooledGarBulks(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     'p','LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','r','MarkerFaceColor','r')
            %
            %                     plot(DataRatios_pooledGarOddball(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_pooledGarOddball(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     'p','LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color',classicrose,'MarkerFaceColor',classicrose)
            % end
            
            
            
            %
            % for i =ihere
            %                 colorhere = 'r';
            %                 MarkerSizeHere = 6;
            %                 if ismember(i,blackoutlines)==1
            %                     colorhere = 'k';
            %                     MarkerSizeHere =12;
            %                 end
            %                 plot(DataRatios_PUM1300U05_001_1000_SM(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1300U05_001_1000_SM(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     char(layerplot_marker_here(i)),'LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','k','MarkerFaceColor','b')
            % end
            
            
            %
            % for i =ihere
            %                 colorhere = airsuperiorityblue;
            %                 MarkerSizeHere = 6;
            %                 if ismember(i,blackoutlines)==1
            %                     colorhere = 'k';
            %                     MarkerSizeHere = 12;
            %                 end
            %                 plot(DataRatios_PUM1450U05_001_500_SM(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1450U05_001_500_SM(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     char(layerplot_marker_here(i)),'LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','k','MarkerFaceColor',airsuperiorityblue)
            % end
            
            
            
            % for i =ihere
            %                 colorhere = 'b';
            %                 MarkerSizeHere = 6;
            %                 if ismember(i,blackoutlines)==1
            %                     colorhere = 'k';
            %                     MarkerSizeHere = 12;
            %                 end
            %                 plot(DataRatios_DMM1450U05_001_0_SM_CORRECTED(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_DMM1450U05_001_0_SM_CORRECTED(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     char(layerplot_marker_here(i)),'LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','k','MarkerFaceColor',olivinegreen)
            % end
            
            
            %        for ipp = 1:size(DMM_Dry,1)
            %       plot(DataRatios_DMM_Dry(ipp,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios_DMM_Dry(ipp,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),'o','LineWidth',1,'MarkerSize',5, 'MarkerFaceColor',eval(DMM_Dry_Colors{ipp}),'Color','none');
            %       end
            
            
            
            
            
            
            
            
            
            test2=yline(1,'k-');
            
            uistack(test2,'bottom')
            
            
            h1=plot(GaleDataPhysicalPropertiesTrace(:,2),newlyOrderedElementsISOTOPES(:,yyvalue)...
                ,'o','Color',grey3,'LineWidth',0.1,'MarkerSize',2,'MarkerFaceColor',grey2);
            
            
            xlabel('Spreading Rate');
            %ylabel(sprintf('%s normalized to %s',RatioLabels{yyvalue}, normalizationLabel));
            ylabel(targetStrings_Isotopes_HERE(n));
            box on
            %grid on
            %set(gcf,'Position',[114 219 973 420])
            FigureTitle = sprintf('%s v. %s normalized to %s',RatioLabels{xxvalue}, RatioLabels{yyvalue}, normalizationLabel);
            FigureTitle = regexprep(FigureTitle,'\_*','');
            FigureTitle = regexprep(FigureTitle,'\/','-');
            
            FigureTitle = 'TraceElement_Isotope_Figure_SpreadingRate';
            set(gcf,'name',regexprep(FigureTitle,'\_*',''))
            %title(FigureTitle)
            set(gcf,'name',FigureTitle)
            axis square
            set(gca,'ticklength',2*[0.0200    0.0500])
            %set(gca,'ticklength',2*get(gca,'ticklength'))
            set(gca,'fontsize', 13,'LineWidth',1)
            set(gca,'XColor', 'k')
            set(gca,'YColor', 'k')
            %  set(gca,'yscale','log')
            % set(gca,'xscale','log')
 
    % end
    % end
    uistack(h1,'bottom')
end



%% trace element ratio isotope
% Goldschmidt final figure trace element ratios XXXX
% Sept 17



targetStrings_Isotopes = {'87Sr/86Sr'	'143Nd/144Nd'	'206Pb/204Pb'	'207Pb/204Pb'	'208Pb/204Pb'	'176Hf/177Hf'};
targetStrings_Isotopes_HERE= {'87Sr/86Sr'	'143Nd/144Nd'	'206Pb/204Pb'	'176Hf/177Hf'};
[A,ElementIndicies4Target] = ismember(targetStrings_Isotopes_HERE, targetStrings_Isotopes);

stableratio = 1;



figure(6)
close


masterratioX = [3 3 1 2  3 1 ];
masterratioY = [1 4 6 6 5 2];
axesMinors = [17 22 .702 .708
    17 22 15.4 15.9
    0.702 .710 .2826 .2836
    .5122 .5134 .2826 .2836
    17 22 37 41
    .702 .710 .5122 .5134];


JACKSON_average = [0.703323	NaN	20.228	15.69	39.743	NaN
    0.702863	NaN	20.64	15.761	39.963	NaN
    0.703223	NaN	19.492	15.593	39.137	NaN
    0.703365	NaN	19.138	15.621	39.053	NaN
    0.703165	NaN	19.495	15.584	39.234	NaN
    0.70295	NaN	19.349	15.543	39.105	NaN
    0.703081	NaN	19.411	15.571	39.229	NaN
    0.703639	NaN	19.458	15.585	39.401	NaN
    0.703969	NaN	19.628	15.637	39.478	NaN
    0.705588	NaN	19.21	15.604	39.408	NaN
    0.704683	NaN	19.073	15.581	38.795	NaN
    0.703988	NaN	19.305	15.579	39.115	NaN
    0.703874	NaN	18.831	15.581	38.896	NaN
    0.705154	NaN	18.27	15.546	38.77	NaN
    0.70454	NaN	17.866	15.498	38.837	NaN
    0.703123	NaN	19.077	15.569	38.716	NaN
    0.703697	NaN	18.344	15.469	38.013	NaN
    0.703126	NaN	18.419	15.458	38.048	NaN
    0.702817	0.5129	21.199	15.767	40.382	NaN
    0.708443	NaN	19.149	15.623	39.491	NaN
    0.704642	NaN	17.826	15.496	38.855	NaN
    0.70227	NaN	18.39	15.506	38.029	NaN
    0.703870	0.512900	19.150	15.590	39.030	0.283
    0.706745	0.512650	19.245	15.596	39.555	NaN
    0.705010	0.512450	17.636	15.481	38.850	NaN
    0.702847	0.512900	21.622	15.819	40.546	0.283
    0.703060	0.512900	19.946	15.765	39.247	0.283];

Jackson_average_label={'HIMU'
    'HIMU'
    'HIMU'
    'HIMU'
    'HIMU'
    'HIMU'
    'HIMU'
    'HIMU'
    'EM2'
    'EM2'
    'EM2'
    'EM2'
    'EM2'
    'EM2'
    'EM1'
    'TH'
    'TH'
    'TH'
    'HIMU_A'
    'EM2_A'
    'EM1_A'
    'MORB'
    'HIMU_B'
    'EM2_B'
    'EM1_B'
    'HIMU_B2'
    'FOZO_B2'};


numrows=2;
numcolumns=3;
hold on

for n = 1:6
    figure(6)
    % set(gcf,'Position',[360 1 693 704])
    set(gcf,'Position',[87 0 1083 704])
    subaxis(numrows,numcolumns,n,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.06,'Padding',0,'PaddingLeft',0.02)
    axis(axesMinors(n,:))
    hold on
    axis square
    
    
    xxvalue = masterratioX(n);
    yyvalue = masterratioY(n);
    
    
     
            colorindex = 1;
            for iiill = 1% suball
                %indexforlenged(iii) = RidgesListIndex{iii}(1);
                clear datasmoosh;
                for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
                    plot(newlyOrderedElementsISOTOPES(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},xxvalue),...
                        newlyOrderedElementsISOTOPES(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yyvalue),...
                        'd', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',8) % GALA14 517	Galapagos
                    % 'o', 'color',colorsjetTrace(colorindex,:), 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
                    %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
                    %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
                    colorindex = colorindex+1;
                end
            end
            
            
            
            %                 plot(DataRatios_GALEsheet(ultraslowspreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(ultraslowspreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','m', 'markerfacecolor','m','markersize',3)
            %
            %                 plot(DataRatios_GALEsheet(slowspreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(slowspreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','r', 'markerfacecolor','r','markersize',3)
            %
            %                       plot(DataRatios_GALEsheet(intermediatespreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(intermediatespreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','b', 'markerfacecolor','b','markersize',3)
            %
            %                 plot(DataRatios_GALEsheet(fastspreadingMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %                 DataRatios_GALEsheet(fastspreadingMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %                 'o', 'color','c', 'markerfacecolor','c','markersize',3)
            
            
            plot(newlyOrderedElementsISOTOPES(emorbs1,xxvalue),...
                newlyOrderedElementsISOTOPES(emorbs1,yyvalue),...
                'o', 'color',grey4, 'markerfacecolor',grey4,'markersize',3)
            
            plot(newlyOrderedElementsISOTOPES(highSmYbMORBS,xxvalue),...
                newlyOrderedElementsISOTOPES(highSmYbMORBS,yyvalue),...
                'o', 'color','r', 'markerfacecolor','r','markersize',3)
            
            
            text(JACKSON_average(:,xxvalue),JACKSON_average(:,yyvalue),Jackson_average_label)
            %
            %
            
            
            
            %     for i = 1:size(Data_SWIR,2)
            %     plot(DataRatios_SWIR(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_SWIR(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'s-r','LineWidth',2,'MarkerSize',8, 'Color','c','MarkerFaceColor',eval(Colors_SWIR{i}));
            %     end
            %
            %     for i = 1:size(Avg_Gale,1)
            %     plot(DataRatios_GALE(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_GALE(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),...
            %         'o-k','LineWidth',1,'MarkerSize',12, 'Color','k','MarkerFaceColor',eval(Colors_GALE{i}));
            %     end
            %
            %
            %       for i = 1:size(Data_McKenzie,2)
            %     plot(DataRatios_McKenzie(xxvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_McKenzie(yyvalue,i)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'o-k','LineWidth',2,'MarkerSize',8, 'Color','k','MarkerFaceColor',eval(Colors_McKenzie{i}));
            %       end
            
            
            %      for i = 1:size(DMM_Dry,1)
            %     plot(DataRatios_DMM_Dry(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_DMM_Dry(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'p-y','LineWidth',2,'MarkerSize',8, 'Color','y','MarkerFaceColor',eval(DMM_Dry_Colors{i}));
            %      end
            
            %       for i = 1:size(Bulky1350U1,1)
            %     plot(DataRatios_Bulky1350U1(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),DataRatios_Bulky1350U1(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue),'v-y','LineWidth',2,'MarkerSize',8, 'Color',bitterLime,'MarkerFaceColor',bitterLime);
            %       end
            
            
            %doesnt work
            %plot(DataRatios_WHFC_Trace(:,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios_WHFC_Trace(:,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),'o-','Color','m','LineWidth',.1,'MarkerSize',2,'MarkerFaceColor','m');
            
            
            %         for i = 1:size(Data_McKenzie,2)
            %         plot([1:numberElements],DataRatios_McKenzie(:,i)'./DataRatios_TraceElements4Normalization(normalizationColumn,:),'o-k','LineWidth',2,'MarkerSize',10, 'Color','k','MarkerFaceColor',eval(Colors_McKenzie{i}))
            %     end
            
            
            %plot(GaleDataOrdered_Mg90(:,xindice), GaleDataOrdered_Mg90(:,i),'.', 'color','m', 'markerfacecolor','m','markersize',1) % GALA14 517	Galapagos
            
            
            %
            %                     plot(DataRatios_PUM1450U05_001_500_IA(:,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1450U05_001_500_IA(:,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     '.','LineWidth',.5,'MarkerSize',5, 'Color',airsuperiorityblue,'MarkerFaceColor',airsuperiorityblue)
            %
            %                     plot(DataRatios_PUM1300U05_001_1000_IA(:,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1300U05_001_1000_IA(:,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     '.','LineWidth',.5,'MarkerSize',5, 'Color','b','MarkerFaceColor','b')
            %
            %                     plot(DataRatios_DMM1450U05_001_0_IA_CORRECTED(:,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_DMM1450U05_001_0_IA_CORRECTED(:,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     '.','LineWidth',1,'MarkerSize',5, 'Color',olivinegreen,'MarkerFaceColor',olivinegreen)
            %
            
            %goodTabNames
            
            
            
            
            
            
            
            % for i =ihere
            %                 MarkerSizeHere = 8;
            % %                 if ismember(i,blackoutlines)==1
            % %                     colorhere = 'k';
            % %                     MarkerSizeHere = 12;
            % %                 end
            %                 plot(DataRatios_pooledGarBulks(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_pooledGarBulks(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     'p','LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','r','MarkerFaceColor','r')
            %
            %                     plot(DataRatios_pooledGarOddball(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_pooledGarOddball(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     'p','LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color',classicrose,'MarkerFaceColor',classicrose)
            % end
            
            
            
            %
            % for i =ihere
            %                 colorhere = 'r';
            %                 MarkerSizeHere = 6;
            %                 if ismember(i,blackoutlines)==1
            %                     colorhere = 'k';
            %                     MarkerSizeHere =12;
            %                 end
            %                 plot(DataRatios_PUM1300U05_001_1000_SM(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1300U05_001_1000_SM(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     char(layerplot_marker_here(i)),'LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','k','MarkerFaceColor','b')
            % end
            
            
            %
            % for i =ihere
            %                 colorhere = airsuperiorityblue;
            %                 MarkerSizeHere = 6;
            %                 if ismember(i,blackoutlines)==1
            %                     colorhere = 'k';
            %                     MarkerSizeHere = 12;
            %                 end
            %                 plot(DataRatios_PUM1450U05_001_500_SM(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_PUM1450U05_001_500_SM(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     char(layerplot_marker_here(i)),'LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','k','MarkerFaceColor',airsuperiorityblue)
            % end
            
            
            
            % for i =ihere
            %                 colorhere = 'b';
            %                 MarkerSizeHere = 6;
            %                 if ismember(i,blackoutlines)==1
            %                     colorhere = 'k';
            %                     MarkerSizeHere = 12;
            %                 end
            %                 plot(DataRatios_DMM1450U05_001_0_SM_CORRECTED(i,xxvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,xxvalue),...
            %                     DataRatios_DMM1450U05_001_0_SM_CORRECTED(i,yyvalue)./DataRatios_TraceElements4Normalization(normalizationColumn,yyvalue), ...
            %                     char(layerplot_marker_here(i)),'LineWidth',1,'MarkerSize',MarkerSizeHere, 'Color','k','MarkerFaceColor',olivinegreen)
            % end
            
            
            %        for ipp = 1:size(DMM_Dry,1)
            %       plot(DataRatios_DMM_Dry(ipp,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios_DMM_Dry(ipp,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),'o','LineWidth',1,'MarkerSize',5, 'MarkerFaceColor',eval(DMM_Dry_Colors{ipp}),'Color','none');
            %       end
            
            
            
            
            
            
            
            
            
            
            
            
            h1=plot(newlyOrderedElementsISOTOPES(:,xxvalue),newlyOrderedElementsISOTOPES(:,yyvalue)...
                ,'o','Color',grey8,'LineWidth',0.1,'MarkerSize',2,'MarkerFaceColor',grey8);
            
            
            ylabel(targetStrings_Isotopes{yyvalue});
            %ylabel(sprintf('%s normalized to %s',RatioLabels{yyvalue}, normalizationLabel));
            xlabel(targetStrings_Isotopes{xxvalue});
            box on
            %grid on
            %set(gcf,'Position',[114 219 973 420])
            FigureTitle = sprintf('%s v. %s normalized to %s',RatioLabels{xxvalue}, RatioLabels{yyvalue}, normalizationLabel);
            FigureTitle = regexprep(FigureTitle,'\_*','');
            FigureTitle = regexprep(FigureTitle,'\/','-');
            
            FigureTitle = 'Isotope_Figure';
            set(gcf,'name',regexprep(FigureTitle,'\_*',''))
            %title(FigureTitle)
            set(gcf,'name',FigureTitle)
            axis square
            set(gca,'ticklength',2*[0.0200    0.0500])
            %set(gca,'ticklength',2*get(gca,'ticklength'))
            set(gca,'fontsize', 13,'LineWidth',1)
            set(gca,'XColor', 'k')
            set(gca,'YColor', 'k')
            
            set(gca,'yscale','log')
            set(gca,'xscale','log')

    % end
    % end
    uistack(h1,'bottom')
    
    set(gca,'yscale','log')
    set(gca,'xscale','log')
end
toc


%% trace element ratios Salters and Hart





figure(10)
% MARR
close






masterratios = [2 3; 2 3];
%axesMinors = [.1 .6 .05 .25];
axesMinors = [-.5 1 -.5 1; -.5 1 -.5 1];


logon = 1;

numrows=1;
numcolumns=2;
figure(10);
hold on
%set(gcf,'Position',[360 1 693 704])
%set(gcf,'Position',[87 0 1083 704])
set(gcf, 'Units', 'Inches', 'Position',   [20.3194 6.0278 10.9722 6.3194],  'PaperSize', [8.5, 11])

for n = [1:2]
    subaxis(numrows,numcolumns,n,'Spacing',.1,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.1,'Padding',0,'PaddingLeft',0.02)
    
    %subaxis(numrows,numcolumns,n,'Spacing',.08,'Margin',0.02,'MarginBottom',.06,'MarginLeft',.06,'Padding',0,'PaddingLeft',0.02)
    axis(axesMinors(n,:))
    hold on
    axis square
    
    
    xxvalue = masterratios(n,1);
    yyvalue = masterratios(n,2);
 
            
            
            if n==9
                colorindex = 1;
                for iiill = 1% suball
                    %indexforlenged(iii) = RidgesListIndex{iii}(1);
                    clear datasmoosh;
                    for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
                        plot(DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
                            DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
                            'd', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',8) % GALA14 517	Galapagos
                        % 'o', 'color',colorsjetTrace(colorindex,:), 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
                        %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
                        %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
                        colorindex = colorindex+1;
                    end
                end
                
                legendkeyhere = [test3];%, legendkey];
                
                %     for iik=1:numberModels; %1:size(TabNames2,2)
                %
                %          if ischar(layerplot_color{iik})==1
                %             layerplot_color_here = eval(char(layerplot_color(iik)));
                %         else
                %             layerplot_color_here = layerplot_color{iik};
                %          end
                %
                %         if ischar(layerplot_color_fill{iik})==1
                %             layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
                %         else
                %             layerplot_color_here_fill = layerplot_color_fill{iik};
                %         end
                %         mymarkersize = layerplot_markersize(iik);
                %
                %                 whichPrimarySM2plot = 10;
                %     if any((strfind(TabNames{iik},'SM')))==1
                %              numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
                %              layerplot_marker_here = SM_Markers;
                %             %layerplot_marker_here = layerplot_marker;
                %             mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
                %                 for lll = 1:numdatapts
                %                               if ismember(lll,whichPrimarySM2plot)
                %                                   %plot(eval(sprintf('%s(lll,%g)', TabNames{i}, xvalue)),eval(sprintf('%s(lll,%g)', TabNames{i}, yvalue)),char(layerplot_marker_here(lll)),'Color','k','MarkerFaceColor',layerplot_color_here_fill,'LineWidth',1,'MarkerSize',mymarkersize)
                %                             plot(eval(sprintf('DataRatios_%s(lll,%g)', TabNames{iik}, xxvalue))./TraceElements4Normalization_DataRatios(xxvalue),eval(sprintf('DataRatios_%s(lll,%g)', ...
                %                                 TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),char(layerplot_marker_here(lll)),...
                %                                 'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',linewidth,'MarkerSize',mymarkersize)
                %                             end
                %                 end
                %         else
                %        
                %         plot(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xxvalue))./TraceElements4Normalization_DataRatios(xxvalue),eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                %             layerplot_marker_here,'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',linewidth,'MarkerSize',mymarkersize)
                %     end
                %     end
                
                if isempty(legendkeyhere) ~= 1
                    lgd = legend(legendkeyhere,'Location','SouthWest')  ;
                    lgd.FontSize = 10;
                    set(lgd,'Position',    [0.2395 0.5852 0.2439 0.1683])
                end
                
                
                %set(lgd,'Position',[0.3288 0.0730 0.1804 0.1868])
                %set(lgd,'Position', [0.5873 0.7684 0.1804 0.2223])
                
                
            end
            
            
            
            
            
            for iik=1:numberModels
                
                if ischar(layerplot_color{iik})==1
                    layerplot_color_here = eval(char(layerplot_color(iik)));
                else
                    layerplot_color_here = layerplot_color{iik};
                end
                
                if ischar(layerplot_color_fill{iik})==1
                    layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
                else
                    layerplot_color_here_fill = layerplot_color_fill{iik};
                end
                mymarkersize = layerplot_markersize(iik);
                
                
                
                
                if any((strfind(TabNames{iik},'SM')))==1
                    LegendModelcounter=1; 
                    numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
                    layerplot_marker_here = SM_Markers;
                    %layerplot_marker_here = layerplot_marker;
                    mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
                    for lll = 1:numdatapts
                        if ismember(lll,whichPrimarySM2plot)%[ 1 2 3 10 11])
                            mymarkersize = SM_MarkerSize(lll) ;
                            %plot(eval(sprintf('%s(lll,%g)', TabNames{i}, xvalue)),eval(sprintf('%s(lll,%g)', TabNames{i}, yvalue)),char(layerplot_marker_here(lll)),'Color','k','MarkerFaceColor',layerplot_color_here_fill,'LineWidth',1,'MarkerSize',mymarkersize)
                            plot((TraceElements4Normalization_DataRatios(xxvalue) - eval(sprintf('DataRatios_%s(lll,%g)', TabNames{iik}, xxvalue)))./TraceElements4Normalization_DataRatios(xxvalue),...
                                (TraceElements4Normalization_DataRatios(yyvalue) - eval(sprintf('DataRatios_%s(lll,%g)',TabNames{iik}, yyvalue)))./TraceElements4Normalization_DataRatios(yyvalue),char(layerplot_marker_here(lll)),...
                                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',linewidth,'MarkerSize',mymarkersize)
                        end
                    end
                else
                   
                    
                    if exist('Colors_index')==1
                        if ismember(iik, b(Colors_index)) ==1 %isempty(eval(sprintf('%s_Colors',TabNames{iik}))) == 0
                            MarkerFaceColorHere = eval(sprintf('%s_Colors',TabNames{iik}));
                            for lljm = 1:size(MarkerFaceColorHere,1)
                                if ismember(MarkerFaceColorHere{lljm},TempColors2plot)==1
                                    plot((TraceElements4Normalization_DataRatios(xxvalue) - eval(sprintf('DataRatios_%s(%d,%g)', TabNames{iik}, lljm,xxvalue)))./TraceElements4Normalization_DataRatios(xxvalue),...
                                        (TraceElements4Normalization_DataRatios(yyvalue) - eval(sprintf('DataRatios_%s(%d,%g)', TabNames{iik}, lljm,yyvalue)))./TraceElements4Normalization_DataRatios(yyvalue),...
                                        layerplot_marker_here,...
                                        'Color',layerplot_color_here,'MarkerFaceColor',eval(MarkerFaceColorHere{lljm}),...
                                        'LineWidth',linewidth,'MarkerSize',mymarkersize)
                                    
                                    
                                    if exist(sprintf('DataRatios_%s_DMM', TabNames{iik})) ==1
                                        plot(eval(sprintf('DataRatios_%s_DMM(%d,%g)', TabNames{iik}, lljm,xxvalue))./TraceElements4Normalization_DataRatios(xxvalue),eval(sprintf('DataRatios_%s_DMM(%d,%g)', TabNames{iik}, lljm,yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                                            layerplot_marker_here,...
                                            'Color',layerplot_color_here,'MarkerFaceColor',eval(MarkerFaceColorHere{lljm}),...
                                            'LineWidth',linewidth,'MarkerSize',mymarkersize)
                                    end
                                end
                                
                            end
                        else
                            
                            
                            plot((TraceElements4Normalization_DataRatios(xxvalue) - eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xxvalue)))./TraceElements4Normalization_DataRatios(xxvalue),...
                                (TraceElements4Normalization_DataRatios(yyvalue)-eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)))./TraceElements4Normalization_DataRatios(yyvalue),...
                                layerplot_marker_here,...
                                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                                'LineWidth',linewidth,'MarkerSize',mymarkersize)
                        end
                    else
                        
                        plot((TraceElements4Normalization_DataRatios(xxvalue)-eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xxvalue)))./TraceElements4Normalization_DataRatios(xxvalue),...
                            (TraceElements4Normalization_DataRatios(yyvalue)-eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)))./TraceElements4Normalization_DataRatios(yyvalue),...
                            layerplot_marker_here,...
                            'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                            'LineWidth',linewidth,'MarkerSize',mymarkersize)
                    end
                    
                    
                end
            end
            
            
            
            
            
            %     colorindex = 1;
            %     for iiill = 1% suball
            %         %indexforlenged(iii) = RidgesListIndex{iii}(1);
            %         clear datasmoosh;
            %         for jjj=1:size(Un_Trace_SegmentArrayIndex{iiill},2) %160;%
            %          plot(DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),...
            %         DataRatios_GALEsheet(unique_idx_trace{Un_Trace_SegmentArrayIndex{iiill}(jjj)},yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %              'd', 'color','k', 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',8) % GALA14 517	Galapagos
            %         % 'o', 'color',colorsjetTrace(colorindex,:), 'markerfacecolor',colorsjetTrace(colorindex,:),'markersize',5) % GALA14 517	Galapagos
            %          %mostprimitivesmoosh = MostPrimitiveGaleDataIndex(RidgesListIndex{iii});
            %          %plot(MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),xindice), MostPrimitiveGaleData(RidgesListIndex{iii}(jjj),i),'p', 'color',colorsjet(colorindex,:), 'markerfacecolor',colorsjet(colorindex,:),'markersize',10) % GALA14 517	Galapagos
            %          colorindex = colorindex+1;
            %         end
            %     end
            %
            %                  if isempty(NamesForFC) ==0
            %              for kjm = 1:size(NamesForFC,2)
            %              goodTabNames2=NamesForFC(kjm);
            %
            %              [a2,b2]=find(ismember(TabNames,goodTabNames2));
            %              majorsHere = eval(sprintf('%s', TabNames{b2}));
            %              columnsarg = [ 3 4 5 6 7 9 10 12 11 13];
            %              majorsHereRightOrder = majorsHere(:,columnsarg);
            %              majorsHereRightOrder(isnan(majorsHereRightOrder))=0;
            %              traceHere = eval(sprintf('%s_Trace', TabNames{b2}));
            %              traceHere(:,44)= 0.*traceHere(:,43);
            %              %whichFractionatedSM2plot=1:34;
            % %              whichFractionatedSM2plot=[1:1:size(majorsHereRightOrder,1)];
            % %              whichFractionatedSM2plot=[10 11];
            % %              whichFractionatedSM2plot=[1:4];
            %              if strcmp(FC,'on') == 1
            %         for layerplotnumXX = whichFractionatedSM2plot
            %
            %         clear testfrac testYYY
            %         %[testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnum,:), 6, traceHere(layerplotnum,:),Dmatrix);
            %         [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnumXX,:), 0.001, traceHere(layerplotnumXX,:),Dmatrix);
            %         f= [testfrac(:,MgOColumn)];
            %         val = 4; %value to find
            %         tmp = abs(f-val);
            %         [idx idy] = min(tmp); %index of closest value
            %         closest = idy;
            %                 %testXXX(:,44)=[];
            %                 clear DataRatios
            %                 for gg = 1:size(ElementRatios,1)
            %                 DataRatios(:,gg) = testXXX(:,ElementRatiosIndex(gg,1)) ./testXXX(:,ElementRatiosIndex(gg,2));
            %                 DataRatios(:,21) = 2.*(testXXX(:,EuCol)./0.154)./((testXXX(:,SmCol)./0.406)+(testXXX(:,GdCol)./0.544));
            %                 end
            %         plot(DataRatios(1:closest,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios(1:closest,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %             '-','Color','m','LineWidth',3);
            %
            %         clear testfrac testYYY
            %         [testfrac,testXXX,testYYY] = YKG_wTRACE(majorsHereRightOrder(layerplotnumXX,:), 6, traceHere(layerplotnumXX,:),Dmatrix);
            %         f= [testfrac(:,MgOColumn)];
            %         tmp = abs(f-val);
            %         [idx idy] = min(tmp); %index of closest value
            %         closest = idy;
            %                 %testXXX(:,44)=[];
            %                 clear DataRatios
            %                 for gg = 1:size(ElementRatios,1)
            %                 DataRatios(:,gg) = testXXX(:,ElementRatiosIndex(gg,1)) ./testXXX(:,ElementRatiosIndex(gg,2));
            %                 DataRatios(:,21) = 2.*(testXXX(:,EuCol)./0.154)./((testXXX(:,SmCol)./0.406)+(testXXX(:,GdCol)./0.544));
            %                 end
            %         plot(DataRatios(1:closest,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios(1:closest,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue),...
            %             '.-','Color','m','LineWidth',3);
            %         end
            %              end
            %              end
            %              end
            
            
            test1 = xline(1,'k-');
            test2=yline(1,'k-');
            uistack(test1,'bottom')
            uistack(test2,'bottom')
            
            
            DataRatios_here = TraceElements4Normalization_DataRatios;
            
            h1=plot((DataRatios_here(xxvalue) - DataRatios_GALEsheet(:,xxvalue))./DataRatios_here(xxvalue),(DataRatios_here(yyvalue) - DataRatios_GALEsheet(:,yyvalue))./DataRatios_here(yyvalue)...
                ,'o','Color',grey8,'LineWidth',0.1,'MarkerSize',2,'MarkerFaceColor',grey8);
            
            h2=plot((DataRatios_here(xxvalue) - DataRatios_GALEsheet(emorbs1,xxvalue))./DataRatios_here(xxvalue),(DataRatios_here(yyvalue) - DataRatios_GALEsheet(emorbs1,yyvalue))./DataRatios_here(yyvalue)...
                ,'o','Color',grey4,'LineWidth',0.1,'MarkerSize',2,'MarkerFaceColor',grey4);
            
            
            % plothighSmYb = 'yes';
            % h4=plot(DataRatios_GALEsheet(highSmYbMORBS,xxvalue)./TraceElements4Normalization_DataRatios(xxvalue),DataRatios_GALEsheet(highSmYbMORBS,yyvalue)./TraceElements4Normalization_DataRatios(yyvalue)...
            %  ,'o','Color','r','LineWidth',0.1,'MarkerSize',2,'MarkerFaceColor','r');
            
            
            h3=plot((DataRatios_here(xxvalue) - DataRatios_GALEsheet(Hirsch1,xxvalue))./DataRatios_here(xxvalue),(DataRatios_here(yyvalue) - DataRatios_GALEsheet(Hirsch1,yyvalue))./DataRatios_here(yyvalue)...
                ,'o','Color',airsuperiorityblue,'LineWidth',0.1,'MarkerSize',2,'MarkerFaceColor',airsuperiorityblue);
            
            plot((DataRatios_here(xxvalue) - kimberlites_DataRatios(:,xxvalue))./DataRatios_here(xxvalue),(DataRatios_here(yyvalue) - kimberlites_DataRatios(:,yyvalue))./DataRatios_here(yyvalue)...
                ,'o','Color','r','LineWidth',0.1,'MarkerSize',4,'MarkerFaceColor','r');
            
            Data_GALE_colors = {'black','olivinegreen','red'}
            for i = 1:size(Avg_Gale,1)
                
                plot((DataRatios_here(xxvalue) - DataRatios_GALE(xxvalue,i))./DataRatios_here(xxvalue),...
                    (DataRatios_here(yyvalue) - DataRatios_GALE(yyvalue,i))./DataRatios_here(yyvalue),...
                    'dk','LineWidth',.5,'MarkerSize',12, 'Color',eval(Data_GALE_colors{i}),'MarkerFaceColor',eval(Data_GALE_colors{i}));
                %'o-k','LineWidth',1,'MarkerSize',12, 'Color','k','MarkerFaceColor',eval(Colors_GALE{i}));
            end
            plot([ .18 .38], [.06 .18],'-pb','MarkerSize',15,'MarkerFaceColor','b', 'LineWidth',2)
            
            
            SM_MarkerSize = [6 10 6 6 10 6 6 10 6 8 12] ;
            %SM_MarkerSize = [6 10 6 6 9 6 6 10 6 14 14] ;
            for iik=1:numberModels
                
                if ischar(layerplot_color{iik})==1
                    layerplot_color_here = eval(char(layerplot_color(iik)));
                else
                    layerplot_color_here = layerplot_color{iik};
                end
                
                if ischar(layerplot_color_fill{iik})==1
                    layerplot_color_here_fill = eval(char(layerplot_color_fill(iik)));
                else
                    layerplot_color_here_fill = layerplot_color_fill{iik};
                end
                mymarkersize = layerplot_markersize(iik);
                
                
                
                
                
                if any((strfind(TabNames{iik},'SM')))==1
                    LegendModelcounter=1; 
                    numdatapts = size(eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)),1);
                    layerplot_marker_here = SM_Markers;
                    %layerplot_marker_here = layerplot_marker;
                    mymarkersizeSpecial = 3;%mymarkersize;       %specialMarkersSizes;
                    for lll = 1:numdatapts
                        if ismember(lll,whichPrimarySM2plot)%[ 1 2 3 10 11])
                            mymarkersize = SM_MarkerSize(lll) ;
                            %plot(eval(sprintf('%s(lll,%g)', TabNames{i}, xvalue)),eval(sprintf('%s(lll,%g)', TabNames{i}, yvalue)),char(layerplot_marker_here(lll)),'Color','k','MarkerFaceColor',layerplot_color_here_fill,'LineWidth',1,'MarkerSize',mymarkersize)
                            plot((TraceElements4Normalization_DataRatios(xxvalue) - eval(sprintf('DataRatios_%s(lll,%g)', TabNames{iik}, xxvalue)))./TraceElements4Normalization_DataRatios(xxvalue),...
                                (TraceElements4Normalization_DataRatios(yyvalue) - eval(sprintf('DataRatios_%s(lll,%g)',TabNames{iik}, yyvalue)))./TraceElements4Normalization_DataRatios(yyvalue),char(layerplot_marker_here(lll)),...
                                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,'LineWidth',linewidth,'MarkerSize',mymarkersize)
                        end
                    end
                else
                   
                    
                    if exist('Colors_index')==1
                        if ismember(iik, b(Colors_index)) ==1 %isempty(eval(sprintf('%s_Colors',TabNames{iik}))) == 0
                            MarkerFaceColorHere = eval(sprintf('%s_Colors',TabNames{iik}));
                            TempColors2plot =  {'blue'; 'green'; 'yellow'; 'red'};
                            
                            MarkerFaceColorHere = regexprep(MarkerFaceColorHere,'black','blue');
                            MarkerFaceColorHere = regexprep(MarkerFaceColorHere,'grey55','green');
                            MarkerFaceColorHere = regexprep(MarkerFaceColorHere,'grey8','yellow');
                            MarkerFaceColorHere = regexprep(MarkerFaceColorHere,'white','red');
                            for lljm = 1:size(MarkerFaceColorHere,1)
                                if ismember(MarkerFaceColorHere{lljm},TempColors2plot)==1
                                    
                                    
                                    plot((TraceElements4Normalization_DataRatios(xxvalue) - eval(sprintf('DataRatios_%s(%d,%g)', TabNames{iik}, lljm,xxvalue)))./TraceElements4Normalization_DataRatios(xxvalue),...
                                        (TraceElements4Normalization_DataRatios(yyvalue) - eval(sprintf('DataRatios_%s(%d,%g)', TabNames{iik}, lljm,yyvalue)))./TraceElements4Normalization_DataRatios(yyvalue),...
                                        layerplot_marker_here,...
                                        'Color',layerplot_color_here,'MarkerFaceColor',eval(MarkerFaceColorHere{lljm}),...
                                        'LineWidth',linewidth,'MarkerSize',mymarkersize)
                                    
                                    
                                    if exist(sprintf('DataRatios_%s_DMM', TabNames{iik})) ==1
                                        plot(eval(sprintf('DataRatios_%s_DMM(%d,%g)', TabNames{iik}, lljm,xxvalue))./TraceElements4Normalization_DataRatios(xxvalue),eval(sprintf('DataRatios_%s_DMM(%d,%g)', TabNames{iik}, lljm,yyvalue))./TraceElements4Normalization_DataRatios(yyvalue),...
                                            layerplot_marker_here,...
                                            'Color',layerplot_color_here,'MarkerFaceColor',eval(MarkerFaceColorHere{lljm}),...
                                            'LineWidth',linewidth,'MarkerSize',mymarkersize)
                                    end
                                end
                                
                            end
                        else
                            
                            
                            plot((TraceElements4Normalization_DataRatios(xxvalue) - eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xxvalue)))./TraceElements4Normalization_DataRatios(xxvalue),...
                                (TraceElements4Normalization_DataRatios(yyvalue)-eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)))./TraceElements4Normalization_DataRatios(yyvalue),...
                                layerplot_marker_here,...
                                'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                                'LineWidth',linewidth,'MarkerSize',mymarkersize)
                        end
                    else
                        
                        plot((TraceElements4Normalization_DataRatios(xxvalue)-eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, xxvalue)))./TraceElements4Normalization_DataRatios(xxvalue),...
                            (TraceElements4Normalization_DataRatios(yyvalue)-eval(sprintf('DataRatios_%s(:,%g)', TabNames{iik}, yyvalue)))./TraceElements4Normalization_DataRatios(yyvalue),...
                            layerplot_marker_here,...
                            'Color',layerplot_color_here,'MarkerFaceColor',layerplot_color_here_fill,...
                            'LineWidth',linewidth,'MarkerSize',mymarkersize)
                    end
                    
                    
                end
            end
            
            
            xlabel(sprintf('%s %s_{%s}','\delta',RatioLabels{xxvalue}, normalizationLabel));
            ylabel(sprintf('%s %s_{%s}','\delta',RatioLabels{yyvalue}, normalizationLabel));
            
            box on
            %grid on
            %set(gcf,'Position',[114 219 973 420])
            FigureTitle = sprintf('%s v. %s normalized to %s',RatioLabels{xxvalue}, RatioLabels{yyvalue}, normalizationLabel);
            FigureTitle = regexprep(FigureTitle,'\_*','');
            FigureTitle = regexprep(FigureTitle,'\/','-');
            
            FigureTitle = 'Salters';
            set(gcf,'name',regexprep(FigureTitle,'\_*',''))
            %title(FigureTitle)
            set(gcf,'name',FigureTitle)
            axis square
            set(gca,'ticklength',2*[0.0200    0.0500])
            %set(gca,'ticklength',2*get(gca,'ticklength'))
            set(gca,'fontsize', 20,'LineWidth',1)
            set(gca,'XColor', 'k')
            set(gca,'YColor', 'k')
            set(gca,'YColor', 'k')
            %set(gca, 'Xtick',1500:10:1540)
            ax = gca;
            %  ax.XAxis.MinorTick = 'on';
            %     increment = findBestIncrement( ax.XLim(2)- ax.XLim(1),ax.XAxis.TickValues(2) -  ax.XAxis.TickValues(1));
            %  ax.XAxis.MinorTickValues = ax.XLim(1):increment:ax.XLim(2);
            set(ax,'XMinorTick','on')
            xline(0,'k');
            yline(0,'k');
            % if logon ==1
            %  set(gca,'yscale','log')
            %   set(gca,'xscale','log')
            % end
            
            % if n == 2
            %
            %     set(gca, 'Xtick', [.001 .01 .1 1])
            % ax.XAxis.MinorTickValues = [[axesMinors(n,1):.001:.01] [.02:.1:1] [2:1:axesMinors(n,2)]];
            % end
  
    % end
    % end
    % if strcmp(plothirsch,'yes')
    %   uistack(h3,'bottom')
    % end
    %
    % if strcmp(plothighSmYb,'yes')
    %   uistack(h4,'bottom')
    % end
    %
    %   uistack(h2,'bottom')
    %   uistack(h1,'bottom')
    
end
%hlegned = legend('all MORB','South African kimberlites','N-MORB','D-MORB','E-MORB','location','Best')

hlegned = legend('all MORB','all E-MORB (La/Sm_{PUM} > 1.5)','Hirschmann and Stolper (1996)','South African kimberlites','N-MORB','D-MORB','E-MORB','location','Best')
%   hlegned = legend('South African kimberlites','N-MORB','D-MORB','E-MORB','location','Best')

set(hlegned,'FontSize',14)

set(hlegned, 'Position',[0.6650 0.8019 0.3057 0.1747])